diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-08-05 11:13:49 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-08-06 19:58:41 +0200 |
commit | 789ef8c639e4621abd36da530bcb5942ac9297da (patch) | |
tree | f225fc3663affc49805f1d309b77b096d40fc8f6 /deps | |
parent | 71931b30b1813b146aaa60f5cdab16c0f9ebebdb (diff) | |
download | hugo-789ef8c639e4621abd36da530bcb5942ac9297da.tar.gz hugo-789ef8c639e4621abd36da530bcb5942ac9297da.zip |
Add support for minification of final output
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
Diffstat (limited to 'deps')
-rw-r--r-- | deps/deps.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/deps/deps.go b/deps/deps.go index a0904483b..3eecffca2 100644 --- a/deps/deps.go +++ b/deps/deps.go @@ -162,7 +162,7 @@ func New(cfg DepsCfg) (*Deps, error) { return nil, err } - resourceSpec, err := resource.NewSpec(ps, logger, cfg.MediaTypes) + resourceSpec, err := resource.NewSpec(ps, logger, cfg.OutputFormats, cfg.MediaTypes) if err != nil { return nil, err } @@ -224,7 +224,7 @@ func (d Deps) ForLanguage(cfg DepsCfg) (*Deps, error) { // The resource cache is global so reuse. // TODO(bep) clean up these inits. resourceCache := d.ResourceSpec.ResourceCache - d.ResourceSpec, err = resource.NewSpec(d.PathSpec, d.Log, cfg.MediaTypes) + d.ResourceSpec, err = resource.NewSpec(d.PathSpec, d.Log, cfg.OutputFormats, cfg.MediaTypes) if err != nil { return nil, err } @@ -267,6 +267,9 @@ type DepsCfg struct { // The media types configured. MediaTypes media.Types + // The output formats configured. + OutputFormats output.Formats + // Template handling. TemplateProvider ResourceProvider WithTemplate func(templ tpl.TemplateHandler) error |