summaryrefslogtreecommitdiffstats
path: root/commands
AgeCommit message (Collapse)Author
2018-10-22commands: Avoid panic in error handler on config errorsBjørn Erik Pedersen
2018-10-17Prevent stale content in Fast Render ModeBjørn Erik Pedersen
We do that by re-render visited pages that is not already in the stack. This may potentially do some double work, but that small penalty should be well worth it. Fixes #5281
2018-10-16commands: Show server error info in browserBjørn Erik Pedersen
The main item in this commit is showing of errors with a file context when running `hugo server`. This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`). But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files. Fixes #5284 Fixes #5290 See #5325 See #5324
2018-10-16Revert "commands: Add .gitignore "hugo new site""Bjørn Erik Pedersen
This fails on Windows, so it needs to be reconsidered. This reverts commit 92979d92889ff8991acfadd42982c2e55d01b163.
2018-10-16commands: Add .gitignore "hugo new site"Nathaniel Peiffer
2018-10-15commands: Add help text to "hugo new"Elliot Forbes
2018-09-23Add directory based archetypesBjørn Erik Pedersen
Given this content: ```bash archetypes ├── default.md └── post-bundle ├── bio.md ├── images │   └── featured.jpg └── index.md ``` ```bash hugo new --kind post-bundle post/my-post ``` Will create a new folder in `/content/post/my-post` with the same set of files as in the `post-bundle` archetypes folder. This commit also improves the archetype language detection, so, if you use template code in your content files, the `.Site` you get is for the correct language. This also means that it is now possible to translate strings defined in the `i18n` bundles, e.g. `{{ i18n "hello" }}`. Fixes #4535
2018-09-21commands: Remove deprecated flagsBjørn Erik Pedersen
2018-09-07commands: Fix golint issuesCameron Moore
commands/hugo.go:65:1: exported method Response.IsUserError should have comment or be unexported commands/import_jekyll.go:100:21: error strings should not be capitalized or end with punctuation or a newline commands/server.go:417:1: receiver name sc should be consistent with previous receiver name s for serverCmd
2018-08-16Add configFile(s) back to the watch list after REMOVE eventAnthony Fok
Fixes #4701
2018-08-16commands: Gracefully handle typos in server config when running the serverBjørn Erik Pedersen
Fixes #5081
2018-08-14commands: Include theme name in version mismatch errorBjørn Erik Pedersen
Fixes #5044
2018-08-06Add support for minification of final outputBjørn Erik Pedersen
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar. This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON. To enable, run Hugo with the `--minify` flag: ```bash hugo --minify ``` This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain. Fixes #1251
2018-07-22Get rid of the utils packageBjørn Erik Pedersen
2018-07-22Update hugo_windows.goBjørn Erik Pedersen
2018-07-18commands: Disable flaky server tests on Windows CIBjørn Erik Pedersen
2018-07-18commands: Increase sleep in server teset to make it less shaky on WindowsBjørn Erik Pedersen
2018-07-08Add "extended" to "hugo version"Anthony Fok
Fixes #4913
2018-07-06Add Hugo Piper with SCSS support and much moreBjørn Erik Pedersen
Before this commit, you would have to use page bundles to do image processing etc. in Hugo. This commit adds * A new `/assets` top-level project or theme dir (configurable via `assetDir`) * A new template func, `resources.Get` which can be used to "get a resource" that can be further processed. This means that you can now do this in your templates (or shortcodes): ```bash {{ $sunset := (resources.Get "images/sunset.jpg").Fill "300x200" }} ``` This also adds a new `extended` build tag that enables powerful SCSS/SASS support with source maps. To compile this from source, you will also need a C compiler installed: ``` HUGO_BUILD_TAGS=extended mage install ``` Note that you can use output of the SCSS processing later in a non-SCSSS-enabled Hugo. The `SCSS` processor is a _Resource transformation step_ and it can be chained with the many others in a pipeline: ```bash {{ $css := resources.Get "styles.scss" | resources.ToCSS | resources.PostCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` The transformation funcs above have aliases, so it can be shortened to: ```bash {{ $css := resources.Get "styles.scss" | toCSS | postCSS | minify | fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` A quick tip would be to avoid the fingerprinting part, and possibly also the not-superfast `postCSS` when you're doing development, as it allows Hugo to be smarter about the rebuilding. Documentation will follow, but have a look at the demo repo in https://github.com/bep/hugo-sass-test New functions to create `Resource` objects: * `resources.Get` (see above) * `resources.FromString`: Create a Resource from a string. New `Resource` transformation funcs: * `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. * `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). * `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. * `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity.. * `resources.Concat`: Concatenates a list of Resource objects. Think of this as a poor man's bundler. * `resources.ExecuteAsTemplate`: Parses and executes the given Resource and data context (e.g. .Site) as a Go template. Fixes #4381 Fixes #4903 Fixes #4858
2018-06-28commands: Fix broken server-reload on config changesBjørn Erik Pedersen
This was accidently broken in Hugo 0.42. Fixes #4878
2018-06-25Create missing head.html partial on new theme generationopenscript
2018-06-25Add html doctype to baseof.html template for new themesopenscript
2018-06-13commands: Do not fail server build when /static is missingBjørn Erik Pedersen
This was a un-intended change in Hugo 0.42. Most sites will have a static directory so this should not be a big issue, but this commit will revert back to old behaviour. Fixes #4846
2018-06-11commands: Create LICENSE rather than LICENSE.md in "new theme"Anthony Fok
See also #4623
2018-06-11commands: Create _default/baseof.html in "new theme"Anthony Fok
Thanks to @digitalcraftsman, @bep and @rdwatters for providing the actual content of the default baseof.html file. Fixes #3576
2018-06-11commands: Make "new theme" feedback more intuitiveAnthony Fok
2018-06-11commands: Move nextStepsText() to new_site.goAnthony Fok
2018-06-10Add support for theme composition and inheritanceBjørn Erik Pedersen
This commit adds support for theme composition and inheritance in Hugo. With this, it helps thinking about a theme as a set of ordered components: ```toml theme = ["my-shortcodes", "base-theme", "hyde"] ``` The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right. So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`. Hugo uses two different algorithms to merge the filesystems, depending on the file type: * For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files. * For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen. The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are plans to improve on this and get a URL scheme so this can be resolved automatically. Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure: * `params` (global and per language) * `menu` (global and per language) * `outputformats` and `mediatypes` The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts. A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others. Fixes #4460 Fixes #4450
2018-06-05Reset the "distinct error logger" on rebuildsBjørn Erik Pedersen
Fixes #4818
2018-05-23Fix some recently broken embedded templatesBjørn Erik Pedersen
And add tests for them. Fixes #4757
2018-05-22commands: Avoid ANSI character output on WindowsLorenz Cuno Klopfenstein
Fixes #4462
2018-05-14commands: Do not show empty BuildDate in versionAnthony Fok
2018-04-16commands: Re-add the missing releaser commandBjørn Erik Pedersen
2018-04-15commands: Remove accidental and breaking space in baseURL flagBjørn Erik Pedersen
And added key-trimming to prevent future mishaps. See #4607
2018-04-14commands: Properly handle CLI slice argumentsBjørn Erik Pedersen
Like `--disableKinds` -- this handling was kind of broken when we recently moved this from global vars See #4607
2018-04-14commands: Correctly handle destination and i18n-warningsBjørn Erik Pedersen
And add some more CLI tests. See #4607
2018-04-13commands: Fix handling of persistent CLI flagsBjørn Erik Pedersen
See #4607
2018-04-12commands: Fix failing Travis server testBjørn Erik Pedersen
2018-04-11commands: Make commands.Execute return a Response objectBjørn Erik Pedersen
We have no global `Hugo` object no more (yay!), and there are some external tools that depends on that value. These tools need to use get that value from `Response.Result`. Note that `commands.Execute` now also takes the arguments as a string slice. This should also make it easier to use, not having to modify `os.Args`. This commit also wraps up this particular issue. Phew! Test coverage in /commands before: 14.4% Now: 53.5% Still work to do, now it is at least possible. Closes #4598
2018-04-11commands: Remove some TODOsBjørn Erik Pedersen
See #4598
2018-04-11commands: Fix the config commandBjørn Erik Pedersen
It now also accepts the `-s` (source) flag. See #4598
2018-04-11commands: Fix some flag diffBjørn Erik Pedersen
The CLI docs output is now identical with the master version. See #4598
2018-04-11commands: Add basic server testBjørn Erik Pedersen
See #4598
2018-04-11commands: Fix TestFixURLBjørn Erik Pedersen
See #4598
2018-04-11commands: Remove the Hugo globalBjørn Erik Pedersen
There are still some cleaning to do, but that felt good. See #4598
2018-04-11commands: Make the limit command work againBjørn Erik Pedersen
See #4598
2018-04-11commands: Move the commands related logic to its own fileBjørn Erik Pedersen
See #4598
2018-04-11commands: Add CLI testsBjørn Erik Pedersen
See #4598
2018-04-11commands: Make the hugo command non-globalBjørn Erik Pedersen
See #4598
2018-04-11commands: Extract some common types into its own fileBjørn Erik Pedersen
See #4598