How to update "uswds rails" gem - department-of-veterans-affairs/diffusion-marketplace GitHub Wiki
- Download the newest version of
uswdsvia their GitHub: https://github.com/uswds/uswds. - Clone the forked
uswds-railsrepository to your local, if you don't already have it, from the Agile Six GitHub: https://github.com/agilesix/uswds-rails. - Branch off of the most recent version branch (
2.11.1as of04/13/21) and name the branch after theuswdsversion number. - Copy the
fonts,images, andscssfolder contents from the newly downloadeduswdsversion and replace the existing folder contents for each of these items within thevendor/assestspath. Important note: Be sure to copy the new folder contents into the correspondinguswdsfolder (ex: copy thefontsfolder contents from the new version to thevendor/assets/fonts/uswdsfolder of the existing version).
- Copy the new
javascripts/uswds.jsfile to the existingvendor/assets/javascripts/uswdsfolder.
- Copy the same
scssfolder from step 3 to the existingapp/assets/stylesheets/uswdsfolder.
- Rails-ify the asset pipeline in the new
scssfiles by addingasset-urlandfont-urlwhere required. Refer to this commit if need be: https://github.com/agilesix/uswds-rails/commit/9efc311b7673b6765bc2cf3ab36903658b479ef3. - Change, if necessary, the
$theme-image-pathvalue in the following files:
- Approximately line
28ofapp/assets/stylesheets/uswds/theme/_uswds-theme-general.scssshould be"uswds". - Approximately line
28ofapp/assets/stylesheets/uswds/settings/_settings-general.scssshould be"uswds" !default. - Approximately line
28ofvendor/assets/stylesheets/uswds/theme/_uswds-theme-general.scssshould be"uswds". - Approximately line
28ofvendor/assets/stylesheets/uswds/settings/_settings-general.scssshould be"uswds" !default.
- Change, if necessary, the
$theme-font-pathvalue in the following files:
- Approximately line
80ofapp/assets/stylesheets/uswds/theme/_uswds-theme-typography.scssshould be"uswds". - Approximately line
80ofapp/assets/stylesheets/uswds/settings/_settings-typography.scssshould be"uswds" !default. - Approximately line
80ofvendor/assets/stylesheets/uswds/theme/_uswds-theme-typography.scssshould be"uswds". - Approximately line
80ofvendor/assets/stylesheets/uswds/settings/_settings-typography.scssshould be"uswds" !default.
- Add, if necessary, the following code to lines
3-5ofapp/assets/stylesheets/uswds/uswds.scss:
// Relative font and image file paths
$font-path: 'uswds';
$image-path: 'uswds';
- Port over all custom javascript from previous version branches in the
agilesix/uswds-railsrepository. This will potentially be a running list of branches that have custom changes which have yet to be resolved by USWDS, along with the commit numbers that contain each change, so please add to this when any future changes are made.
As of04/13/21:- Branch
2.8.1: commits2e308f7bb3835f917ea556d8f5d03006688096f6,79b82e18284a94e6a8e083b6fbf022a66df75140, andbc5c729d132ef27ccdcf26bdf6cfac530d92ebeb.
- Branch
- Change the
uswdsversion number to match the newest version you want to use in thelib/uswds/rails/version.rbfile. - Commit these changes and push the new branch to GitHub.
- Branch off of
diffusion-marketplace's master branch and point to the newagilesix/uswds-railsbranch you created in step3by changing therefvalue for theuswds-railsgem in thegemfile(ex:gem 'uswds-rails', github: 'agilesix/uswds-rails', ref: 'abc1234'. - Run
bundle install. - Check for any potential adverse effects of upgrading the
uswdsversion and make sure everything looks and works as expected.
If you commit additional changes to the new agilesix/uswds-rails branch, be sure to checkout to the diffusion-marketplace branch you created in step 14 and update the ref value in the gemfile and run bundle install.
