diff options
Diffstat (limited to 'resources/resource_spec.go')
-rw-r--r-- | resources/resource_spec.go | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/resources/resource_spec.go b/resources/resource_spec.go index 17225e3f5..0ca60fe31 100644 --- a/resources/resource_spec.go +++ b/resources/resource_spec.go @@ -23,6 +23,8 @@ import ( "strings" "sync" + "github.com/gohugoio/hugo/resources/jsconfig" + "github.com/gohugoio/hugo/common/herrors" "github.com/gohugoio/hugo/config" @@ -76,17 +78,20 @@ func NewSpec( } rs := &Spec{ - PathSpec: s, - Logger: logger, - ErrorSender: errorHandler, - imaging: imaging, - incr: incr, - MediaTypes: mimeTypes, - OutputFormats: outputFormats, - Permalinks: permalinks, - BuildConfig: config.DecodeBuild(s.Cfg), - FileCaches: fileCaches, - PostProcessResources: make(map[string]postpub.PostPublishedResource), + PathSpec: s, + Logger: logger, + ErrorSender: errorHandler, + imaging: imaging, + incr: incr, + MediaTypes: mimeTypes, + OutputFormats: outputFormats, + Permalinks: permalinks, + BuildConfig: config.DecodeBuild(s.Cfg), + FileCaches: fileCaches, + PostBuildAssets: &PostBuildAssets{ + PostProcessResources: make(map[string]postpub.PostPublishedResource), + JSConfigBuilder: jsconfig.NewBuilder(), + }, imageCache: newImageCache( fileCaches.ImageCache(), @@ -121,8 +126,15 @@ type Spec struct { ResourceCache *ResourceCache FileCaches filecache.Caches + // Assets used after the build is done. + // This is shared between all sites. + *PostBuildAssets +} + +type PostBuildAssets struct { postProcessMu sync.RWMutex PostProcessResources map[string]postpub.PostPublishedResource + JSConfigBuilder *jsconfig.Builder } func (r *Spec) New(fd ResourceSourceDescriptor) (resource.Resource, error) { |