Third-party libraries we want to use have previously been kept in the
As of 2018-10 we are moving to using node packages and NPM to manage versions and dependencies. This will be a gradual migration. Meanwhile,
/v2/js/deps will be updated as needed, but no additional libraries will be added.
Moving to NPM resolves some of the outstanding questions around 3rd party libraries.
- A way to document the libraries' functionality, and current maintenance status.
- A simple way to track pages using the libraries by greping for require(). This may generate an automated list in the future.
- A way to upgrade without risking having multiple versions in production, although we will need to be careful about libraries already in
- This approach will simplify minimizing libraries as most packages provide a minimized version or are compatible with minify/uglify.
- Packaged modules should make it easier to concatenate everything into a single minified package without any special cases. This should reduce the number of requests to load a page and may have gzip benefits.
npm install library-name --save
or for things used only in the build or testing
npm install library-name --save-dev
var libraryName = require("library-name");
Versions will be automatically kept and maintained in package.json and package-lock.json. To update to the latest versions run.
Test thouroughly and commit package.json and package-lock.json.
styleguide/styleguide.less, line 9