summaryrefslogtreecommitdiffhomepage
path: root/publisher
diff options
context:
space:
mode:
authorSatowTakeshi <[email protected]>2020-02-29 18:44:05 +0900
committerBjørn Erik Pedersen <[email protected]>2020-03-20 20:35:57 +0100
commit574c2959b8d3338764fa1db102a5e0fd6ed322d9 (patch)
tree185d13348f474d1bb0bb2b0fbfd6bec9d11c8f5e /publisher
parent99958f90fedec11d749a1397300860aa8e8459c2 (diff)
downloadhugo-574c2959b8d3338764fa1db102a5e0fd6ed322d9.tar.gz
hugo-574c2959b8d3338764fa1db102a5e0fd6ed322d9.zip
Add minify config
Fixes #6750 Updates #6892
Diffstat (limited to 'publisher')
-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