-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an experimental "hugo npm install" command #7644
Comments
So this would mean all the imported Module's I can see it as a way for Hugo Modules to specify their won npm packages and so would avoid having to ask the user to install x or x npm package (PostCSS, Tailwind etc...). I'd love to play with that! |
Well, the end result will be like that, but I'm certainly not implementing that logic. My thinking is that a simple loop and then creating this "node_modules" overlay. But I kind of don't know how this would work until I/we tried it out, hence the "experimental label". |
... maybe a merge of the dependency sections would be simpler/faster -- I will experiment. |
OK, I have thought a little more about this, and I think a good middle ground for this would be to:
Also, I've had a fair amount of Tailwind "minor version" breakage lately, so if I get time I will probably implement this using minimal version selection: https://about.sourcegraph.com/blog/the-pain-that-minimal-version-selection-solves/ |
Fixes gohugoio#7644 Fixes gohugoio#7656
Fixes gohugoio#7644 Fixes gohugoio#7656
Fixes gohugoio#7644 Fixes gohugoio#7656
Fixes gohugoio#7644 Fixes gohugoio#7656
Fixes gohugoio#7644 Fixes gohugoio#7656
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. Fixes gohugoio#7644 Fixes gohugoio#7656
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. Fixes gohugoio#7644 Fixes gohugoio#7656
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. Fixes gohugoio#7644 Fixes gohugoio#7656
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 if it exists and `HUGO_WORKDIR` to the env when running the JS tools above. Fixes gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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 gohugoio#7644 Fixes gohugoio#7656 Fixes gohugoio#7675
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
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have been struggling with some npm (e.g. node_modules) dependency setup with Hugo Modules, and I suspect I'm not alone.
I have been avoiding this issue for some time now, but I think I'm going to try out something simple. I'll call this "experimental" in the sense that as a Hugo feature it may be changed or possibly even removed (if it doesn't really work) in a future version without too much notice.
The premise here is that 1) It's not really practically possible to specify "path to package.json" etc. when running "npm install" and 2) While there is a defined lookup order for
node_modules
folders, that order is strictly file system hierarchical -- which doesn't really match how Hugo works in this area.So, my current idea is that:
package.json
in its module root (which can be different from the Git repo root)So, if we
npm install
node_modules
folder to the main project./cc @regisphilibert @budparr does this sound wild enough?
The text was updated successfully, but these errors were encountered: