These directories illustrate how to use the Design System uswds
npm package
with different tools:
- Compiling CSS with node-sass
- Bundling JavaScript with browserify and webpack
- Automating CSS and JS generation with the Grunt and Gulp task runners
For each of these examples, you'll need to first install Node.js version 4 or
greater. Node comes with npm, the Node Package Manager, a dependency manager
that uses the package.json
in each directory to:
- determine what to download and install when you run
npm install
- run repeatable tasks, or scripts
- publish your work to the npm registry
If you require('uswds')
in your bundled JS, you will get the minified ES5 browser bundle. If you're handling ES5 conversion already or using a tool that does it automatically, you can work around this in two ways:
- Import the specific entry point with
require('uswds/src/js/start')
. - Configure your bundler to read the entry point from the
jsnext:main
field instead ofmain
.