diff options
author | SatowTakeshi <[email protected]> | 2020-02-29 18:44:05 +0900 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-03-20 20:35:57 +0100 |
commit | 574c2959b8d3338764fa1db102a5e0fd6ed322d9 (patch) | |
tree | 185d13348f474d1bb0bb2b0fbfd6bec9d11c8f5e /publisher | |
parent | 99958f90fedec11d749a1397300860aa8e8459c2 (diff) | |
download | hugo-574c2959b8d3338764fa1db102a5e0fd6ed322d9.tar.gz hugo-574c2959b8d3338764fa1db102a5e0fd6ed322d9.zip |
Add minify config
Fixes #6750
Updates #6892
Diffstat (limited to 'publisher')
-rw-r--r-- | publisher/publisher.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/publisher/publisher.go b/publisher/publisher.go index 119be356b..e1179572b 100644 --- a/publisher/publisher.go +++ b/publisher/publisher.go @@ -18,6 +18,7 @@ import ( "io" "sync/atomic" + "github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/minifiers" @@ -73,13 +74,17 @@ type DestinationPublisher struct { } // NewDestinationPublisher creates a new DestinationPublisher. -func NewDestinationPublisher(fs afero.Fs, outputFormats output.Formats, mediaTypes media.Types, minify bool) DestinationPublisher { - pub := DestinationPublisher{fs: fs} +func NewDestinationPublisher(fs afero.Fs, outputFormats output.Formats, mediaTypes media.Types, cfg config.Provider) (pub DestinationPublisher, err error) { + pub = DestinationPublisher{fs: fs} + minify := cfg.GetBool("minify") if minify { - pub.min = minifiers.New(mediaTypes, outputFormats) + pub.min, err = minifiers.New(mediaTypes, outputFormats, cfg) + if err != nil { + return + } pub.minify = true } - return pub + return } // Publish applies any relevant transformations and writes the file |