summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-22 09:43:53 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-22 12:43:50 +0100
commit59af05cabc74e381afb62e624afa5542a9ae8d68 (patch)
tree444fb9c276172731a5cb8f6de52adaf21bafc21b /common
parent4989da653d601dcb539338f7e12ae825ce4a0db9 (diff)
Add HUGO_PUBLISHDIR to the Node environment
So you can do `process.env.HUGO_PUBLISHDIR` in your `postcss.config.js` to figure out where Hugo publishes its files. Note that the value will always be an absolute file path and will point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags: ``` hugo server --renderToDisk hugo server --renderStaticToDisk ``` Fixes #10554
Diffstat (limited to 'common')
-rw-r--r--common/hugo/hugo.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go
index 86a81a5d8..efcb470a3 100644
--- a/common/hugo/hugo.go
+++ b/common/hugo/hugo.go
@@ -126,6 +126,8 @@ func GetExecEnviron(workDir string, cfg config.Provider, fs afero.Fs) []string {
config.SetEnvVars(&env, "HUGO_ENVIRONMENT", cfg.GetString("environment"))
config.SetEnvVars(&env, "HUGO_ENV", cfg.GetString("environment"))
+ config.SetEnvVars(&env, "HUGO_PUBLISHDIR", filepath.Join(workDir, cfg.GetString("publishDirOrig")))
+
if fs != nil {
fis, err := afero.ReadDir(fs, files.FolderJSConfig)
if err == nil {