Skip to content

Rename all.scss to uswds.scss; add version comment#1530

Merged
juliasolorzano merged 18 commits into
stagingfrom
rename-scss
Oct 27, 2016
Merged

Rename all.scss to uswds.scss; add version comment#1530
juliasolorzano merged 18 commits into
stagingfrom
rename-scss

Conversation

@shawnbot

@shawnbot shawnbot commented Oct 19, 2016

Copy link
Copy Markdown
Contributor

Sass entrypoint: uswds

This PR renames src/stylesheets/all.scss to uswds.scss, which fixes #1417 by making it possible to import in Sass by adding the src/stylesheets directory to their include path and importing it with:

@import 'uswds';

For users of the existing all.scss, I've included a fallback _all.scss that prevents breakage for users of the old Sass entrypoint via @import 'all';.

CSS version comment

I've also included a fix for #1529 in the form of a CSS comment at the top of both the un-minified and minified CSS files that looks like this:

/*! uswds v0.13.1 */

where 0.13.1 will be whatever our version field specifies in package.json. I've placed this comment at the top of our uswds.scss file, so any users who import this file will get the comment in their CSS, which can help us debug future issues in user-generated CSS.

ℹ️ The ! is a convention that suggests minifiers preserve the comment, and ensures that it isn't stripped in uswds.min.css.

Tests!

There are tests for all of this:

  1. The "sass/build" tests confirm that running gulp build generates the expected uswds.css and uswds.min.css files, and that both of them contain the expected version string.

    ⚠️ This slows down the tests because we're shelling out to gulp build (which is "wasting" time also building the JavaScript), but I think that it's worth it. We may need to play with the 15-second timeout a bit if the build ends up taking longer on CI than on my computer.

  2. The "sass/include" tests confirm that rendering raw Sass that imports either uswds or all from our include path doesn't generate an error.

@juliasolorzano

Copy link
Copy Markdown

@shawnbot a few things:

  1. We need to update our documentation to state that we are making this change: https://github.com/18F/web-design-standards/blob/staging/README.md
  2. Let's open a PR in https://github.com/18F/web-design-standards-docs that correlates with this change so that we don't run into any breakage on the site (e.g. gulp tasks)

@shawnbot

Copy link
Copy Markdown
Contributor Author
  1. Yes, agreed! The docs state in this file that:

    The main Sass (SCSS) source file is here:

    node_modules/uswds/src/stylesheets/all.scss
    

    And this just needs to be changed to say uswds.scss.

  2. I've tested it locally, and it doesn't require a change because of the _all.scss fallback. But yes, we should point it at the right file. 😄

@shawnbot shawnbot changed the title Rename all.scss to uswds.scss [WIP] Rename all.scss to uswds.scss Oct 20, 2016
@shawnbot shawnbot changed the title [WIP] Rename all.scss to uswds.scss [WIP] Rename all.scss to uswds.scss; add version comment Oct 20, 2016
@shawnbot

shawnbot commented Oct 20, 2016

Copy link
Copy Markdown
Contributor Author

Okay, so I've got some updates locally that add a version comment (fixing #1529) to the generated CSS, as well as some tests to confirm that the build process is generating the right files and including the version comment in each. I'll update the description accordingly.

I can't push these because it looks like United is blocking whatever port git uses, so for now I'm marking this as WIP.

@shawnbot shawnbot changed the title [WIP] Rename all.scss to uswds.scss; add version comment Rename all.scss to uswds.scss; add version comment Oct 20, 2016
@shawnbot

Copy link
Copy Markdown
Contributor Author

Okay, ready for your review, @juliaelman! I think we can handle the documentation updates separately once this is merged.

@juliasolorzano juliasolorzano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fantastic! Just a few typos and we're gtg.

Comment thread spec/sass/build.spec.js Outdated

describe('build output', function () {

it('generates CSS at dist/css/uwsds.css', function () {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s uwsds.css/uswds.css

Comment thread spec/sass/build.spec.js Outdated
);
});

it('generates minified CSS at dist/css/uwsds.min.css', function () {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s uwsds.css/uswds.css

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DERP

Julia Elman and others added 2 commits October 27, 2016 11:17
@shawnbot

Copy link
Copy Markdown
Contributor Author

Okay, fixed those typos @juliaelman! 😬

@juliasolorzano

Copy link
Copy Markdown

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants