18F / generator-uswds

A Yeoman generator for the U.S. Web Design Standards
Other
1 stars 3 forks source link

Reference the Jekyll USWDS template; refactor; add tests! #3

Closed shawnbot closed 7 years ago

shawnbot commented 7 years ago

This is a refactoring of basically the whole shebang: the template directories for various configurations, and the generator code that tells Yeoman which files to copy under certain circumstances. Here's the gist:

  1. The entire app/templates/jekyll template directory is now a git submodule pointing at the "template" repo. This means that the boilerplate (config and data files) lives in one place.
  2. The generator now asks you whether you'd like to use Jekyll and Sass independently.
  3. The Jekyll setup involves copying all of the files from the template repo, minus the .git submodule metadata directory.
  4. The non-Jekyll ("static") setup involves:
    • Copying over the entire dist directory from the npm installation to assets/uswds
    • Copying the contents of the app/templates/static directory
    • If you pass --sass or answer Y to the Sass question, we copy the contents of app/templates/static-sass and extend package.json with the contents of package.ext.json.

There are now unit tests for most of these decisions that use the yeoman-test and yeoman-assert libs recommended in Yeoman's testing guide. You can run them with npm test, assuming you've also run npm install --dev beforehand.