From 574c2959b8d3338764fa1db102a5e0fd6ed322d9 Mon Sep 17 00:00:00 2001 From: SatowTakeshi Date: Sat, 29 Feb 2020 18:44:05 +0900 Subject: Add minify config Fixes #6750 Updates #6892 --- publisher/publisher.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'publisher') 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 -- cgit v1.2.3