uswds / uswds

The U.S. Web Design System helps the federal government build fast, accessible, mobile-friendly websites.
https://designsystem.digital.gov
Other
6.8k stars 932 forks source link

Move mixins to their own files #1763

Closed sawyerh closed 7 years ago

sawyerh commented 7 years ago

Currently, both mixins and rulesets sometimes live within the same Sass file. For example, elements/_typography includes rulesets for base HTML elements, but also includes Sass mixins. This prevents someone from being able to import just the mixins into their Sass project and would be much more usable if they were moved to a separate, mixins-only, file.

I'd propose either:

  1. Create a core/_mixins.scss file, similar to how you currently have a core/_variables.scss file
  2. Or, preferably, follow a pattern like ITCSS where there's a tools and settings layer for things like mixins and variables.

This would allow an existing Sass project to do:

@import '~uswds/core/mixins';
@import 'my-custom-mixins';

.my-heading {
  @include h1;
}

I'd be happy to make this pull request, but would like to get your thoughts before moving things around 😁

cc #1342

juliaelman commented 7 years ago

@sawyerh thanks for opening this issue. This sounds like a great idea to helping enhance the customization options for the Standards. Looking forward to reviewing your pull request!