aboutsummaryrefslogtreecommitdiffhomepage
path: root/publisher/publisher.go
diff options
context:
space:
mode:
Diffstat (limited to 'publisher/publisher.go')
-rw-r--r--publisher/publisher.go13
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