Repository navigation
npm-dep modernization: source Bootstrap and Font Awesome from npm - #2670
Merged
chalin merged 11 commits intoJun 30, 2026
Merged
Conversation
- Bootstrap and Font-Awesome were pulled in as Hugo-module `imports` of their GitHub repos — a workaround, since neither publishes a Go module. Hugo's first-class npm-module support (>= 0.159, `hugo mod npm pack`) makes that redundant: the existing `node_modules/*` mounts resolve project-relative, so consumers source both from the theme's declared npm deps. - Drops the two imports from `theme/hugo.yaml`; removes the generated `theme/go.mod` requires and `theme/go.sum`, the `scripts/getHugoModules/` generator, and its `get:hugo-modules` step in `_prepare`. - Adds the PostCSS toolchain (autoprefixer, postcss, postcss-cli) to `theme/package.json` so Hugo-module consumers get it via `hugo mod npm pack` instead of installing it manually. - docsy.dev builds byte-identical vendored CSS, JS, and webfonts.
chalin
force-pushed
the
chalin-m24-npm-dep-modernization-2026-0629
branch
from
June 30, 2026 01:50
b1f4f02 to
c399474
Compare
- The Hugo-module smoke path now runs `hugo mod npm pack && npm install` to pull the theme's npm deps (Bootstrap, Font-Awesome, PostCSS tooling), replacing the manual PostCSS install — mirroring how downstream Hugo-module sites consume Docsy now that the BS/FA imports are gone.
- `theme/assets/_vendor/bootstrap/scss/_rfs.scss` and its sync step (`_cp:bs-rfs`) worked around a Go-module bug (golang/go#37397, golang/go#71785): Go omits `vendor/` subdirectories when fetching a dependency as a module, so the former Bootstrap Hugo-module import dropped `scss/vendor/_rfs.scss`. - Now that Bootstrap is sourced from npm, the `node_modules/bootstrap` mount carries `scss/vendor/_rfs.scss` directly, so the committed copy, its `assets/vendor/bootstrap/scss/vendor` mount, and the `_cp:bs-rfs` prepare step are no longer needed. - docsy.dev builds byte-identical vendored CSS.
- Adds a release-report section and a changelog entry for sourcing Bootstrap and Font Awesome from npm: the upgrade action for Hugo-module sites (`hugo mod npm pack` then `npm install`), with a note that npm-package and clone/submodule sites are unaffected.
mkdirp-hugo-mod.js created empty node_modules/github.com/<path> stub dirs so non-module consumers wouldn't choke on the theme's github.com Hugo-module imports. Sourcing Bootstrap and Font Awesome from npm removed those imports, so theme/go.mod no longer has any github.com requires and the script creates nothing. Remove the script, its _mkdir:hugo-mod npm task and the now-redundant _postinstall indirection (postinstall runs install:theme-deps directly), the npm-pack contract entry, and the two test harnesses that invoked it.
test:smoke built sites under the repo's own tmp/, so Node could resolve the repo's node_modules and let a packaging gap pass locally even though a clean CI checkout would fail. Build under the OS temp dir instead, and pin HUGO to the repo's installed binary so only the build tool — not the dependencies under test — is borrowed from the repo. CI smoke (smoke.yaml) runs from a clean checkout and is unaffected.
chalin
force-pushed
the
chalin-m24-npm-dep-modernization-2026-0629
branch
from
June 30, 2026 13:37
c399474 to
8605307
Compare
…deps
- Runs `postCSS` for a non-RTL production build only when the site provides a project-root `postcss.config.{js,mjs,cjs}`; otherwise the Sass output is used as-is. RTL still runs `postCSS` for `rtlcss`.
- Fixes a latent footgun: the unconditional production `postCSS` call required the PostCSS toolchain on every site yet did nothing without a config — the repo-root config stopped being discovered after the monorepo/theme-folder restructure, so autoprefixing had silently become a no-op.
- Drops `autoprefixer`/`postcss`/`postcss-cli` from `theme/package.json` (reversing the bundling added earlier in this branch) and the now-unused `autoprefixer`/`postcss-cli` from `docsy.dev`; deletes the orphaned root `postcss.config.js`.
- Stops `make-site.sh` and the smoke clone test from installing PostCSS for non-RTL sites.
- Adds a fixture-site test locking the gate: a non-RTL production build succeeds with no PostCSS toolchain, and a project-root config opts the pass back in.
- Adds a release-report section and changelog entry: non-RTL sites no longer need a PostCSS toolchain, can drop `autoprefixer`/`postcss`/`postcss-cli`, and opt back in with a project-root `postcss.config.js`; Docsy's CSS targets the Browserslist `defaults` browsers. - Corrects the npm-deps section to stop claiming the theme ships the PostCSS toolchain, and removes the obsolete clone-install PostCSS step. - Fixes the RTL docs to list the full toolchain the RTL transform needs (`rtlcss` plus `postcss`/`postcss-cli`/`autoprefixer`), which Docsy no longer bundles. - Seeds the new Browserslist link into `.lycheecache`.
chalin
force-pushed
the
chalin-m24-npm-dep-modernization-2026-0629
branch
from
June 30, 2026 20:14
1dbd57c to
24b311d
Compare
chalin
marked this pull request as ready for review
June 30, 2026 23:08
- Restores the `_postinstall` npm target (sometimes invoked directly) and routes `postinstall` through it again. - Trims the `head-css.html` PostCSS comment to the non-obvious intent; the branches already read clearly. - Updates the now-stale fixture `build-site.mjs` comment: the symlinked `node_modules` provides the theme's Bootstrap/Font Awesome SCSS, not PostCSS.
- Leads the release-report and changelog npm-deps items with the Hugo-module scope, so non-module installs see up front that the change doesn't apply to them. - Phrases the PostCSS change as "sites with RTL languages" rather than "RTL languages". - Drops the redundant `postcss` from the RTL install command (it comes in as a peer of `postcss-cli`/`autoprefixer`) and links the `rtlcss` package. - Corrects the release-report wording: the theme keeps `go.mod`; only its generated module requires are retired.
`npm run postinstall` can be invoked directly without triggering other lifecycle scripts, so the separate `_postinstall` target isn't needed.
Closed
8 tasks done
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hugo mod npm pack) makes the imports redundant, sotheme/package.jsonbecomes the single source of truth and also carries the PostCSS toolchain.importsfromtheme/hugo.yaml, the generatedtheme/go.modrequires andtheme/go.sum, and thescripts/getHugoModules/generator with itsget:hugo-modulesprepare step.rfsvendor workaround (theme/assets/_vendor/,_cp:bs-rfs), which existed only because Go omitsvendor/subdirectories from module dependencies (cmd/go: non-top-level packages ending in "/vendor" are omitted from module zip files golang/go#37397); the npm mount carriesscss/vendor/_rfs.scssdirectly.hugo mod npm packandnpm installto pull the theme's npm deps (Bootstrap, Font Awesome, PostCSS). npm-package and clone/submodule sites are unaffected — deps still come via Docsy'spostinstall. Documented in the 0.16.0 release report and changelog.make-sitesmoke matrix (NPM, Hugo module, clone) is green for all three install methods across Linux and Windows, with the Hugo-module path adapted to thehugo mod npm packflow.