summaryrefslogtreecommitdiffstats
path: root/hugolib/resource_chain_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-09-09 22:31:43 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-09-13 20:55:29 +0200
commit85ba9bfffba9bfd0b095cb766f72700d4c211e31 (patch)
tree43b66efaafe4cb804234ca7273873ab949305799 /hugolib/resource_chain_test.go
parent9df60b62f9c4e36a269f0c6e9a69bee9dc691031 (diff)
Add "hugo mod npm pack"
This commit also introduces a convention where these common JS config files, including `package.hugo.json`, gets mounted into: ``` assets/_jsconfig ´`` These files mapped to their real filename will be added to the environment when running PostCSS, Babel etc., so you can do `process.env.HUGO_FILE_TAILWIND_CONFIG_JS` to resolve the real filename. But do note that `assets` is a composite/union filesystem, so if your config file is not meant to be overridden, name them something specific. This commit also adds adds `workDir/node_modules` to `NODE_PATH` and `HUGO_WORKDIR` to the env when running the JS tools above. Fixes #7644 Fixes #7656 Fixes #7675
Diffstat (limited to 'hugolib/resource_chain_test.go')
-rw-r--r--hugolib/resource_chain_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index 64484f1f4..7573199aa 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -873,6 +873,10 @@ func TestResourceChainPostCSS(t *testing.T) {
postcssConfig := `
console.error("Hugo Environment:", process.env.HUGO_ENVIRONMENT );
+// https://github.com/gohugoio/hugo/issues/7656
+console.error("package.json:", process.env.HUGO_FILE_PACKAGE_JSON );
+console.error("PostCSS Config File:", process.env.HUGO_FILE_POSTCSS_CONFIG_JS );
+
module.exports = {
plugins: [
@@ -954,6 +958,8 @@ class-in-b {
// Make sure Node sees this.
b.Assert(logBuf.String(), qt.Contains, "Hugo Environment: production")
+ b.Assert(logBuf.String(), qt.Contains, fmt.Sprintf("PostCSS Config File: %s/postcss.config.js", workDir))
+ b.Assert(logBuf.String(), qt.Contains, fmt.Sprintf("package.json: %s/package.json", workDir))
b.AssertFileContent("public/index.html", `
Styles RelPermalink: /css/styles.css