This PR updates the build pipeline to improve a few things:
Tweak husky config
Drop webpack as a requirement
Improvements for reloading in dev
Husky
The change to the husky config prevents double-prompting which occurs when git commit is aliased to git cz.
Drop Webpack
Previously there were 3 build tools 11ty, gulp, and webpack. With gulp handling the build & dist bundle of the package, 11ty handling the docs templates and webpack handling the docs site assets.
Webpack was mostly being used solely for copying files - which seems slightly overkill. Also using 3 tools was slow, and due to the parallel nature of the task would often result in multiple reloads. So this PR moves the tasks done by webpack to 11ty and gulp.
Dev reloading
Previously, changes to the src/component files would not be watched and picked up in the dev site, making local dev a bit slow.
This PR adds the ability to pass an ENV='dev' environment variable to 11ty, which modifies the nunjucks environment to look in the src/ directory for nunjucks templates. Allowing for 11ty to rebuild when a change is made to them.
The changes in this PR mean that now 11ty is responsible for watching and building the docs site assets, and gulp now has the build:docs task to copy the assets required for the site, and the watch:package task to watch for changes in the component scss and js files.
In order to achieve this, the assets directory has been moved within the docs directory, to place it within 11ty's watch scope.
Gulp does not copy across the all.js file from src, 11ty is configured to watch the all.js file. When gulp builds the package files, generating all.js this triggers an 11ty rebuild.
This means that now, any change to any .njk, .md, .js or .scss file will trigger a fast rebuild and reload of the site in dev.
This PR updates the build pipeline to improve a few things:
Husky
The change to the husky config prevents double-prompting which occurs when
git commit
is aliased togit cz
.Drop Webpack
Previously there were 3 build tools 11ty, gulp, and webpack. With gulp handling the build & dist bundle of the package, 11ty handling the docs templates and webpack handling the docs site assets.
Webpack was mostly being used solely for copying files - which seems slightly overkill. Also using 3 tools was slow, and due to the parallel nature of the task would often result in multiple reloads. So this PR moves the tasks done by webpack to 11ty and gulp.
Dev reloading
Previously, changes to the
src/component
files would not be watched and picked up in the dev site, making local dev a bit slow.This PR adds the ability to pass an
ENV='dev'
environment variable to 11ty, which modifies the nunjucks environment to look in thesrc/
directory for nunjucks templates. Allowing for 11ty to rebuild when a change is made to them.The changes in this PR mean that now 11ty is responsible for watching and building the docs site assets, and gulp now has the
build:docs
task to copy the assets required for the site, and thewatch:package
task to watch for changes in the componentscss
andjs
files.In order to achieve this, the
assets
directory has been moved within thedocs
directory, to place it within 11ty's watch scope.Gulp does not copy across the
all.js
file fromsrc
, 11ty is configured to watch theall.js
file. When gulp builds the package files, generatingall.js
this triggers an 11ty rebuild.This means that now, any change to any
.njk
,.md
,.js
or.scss
file will trigger a fast rebuild and reload of the site in dev.