Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass module system #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

peiche
Copy link

@peiche peiche commented Oct 23, 2019

I updated to the latest version of Sass, which introduces their new module system. All @import directives have been converted to @use; built-in modules have been updated. I also added the stylelint-scss plugin so linting doesn't freak out over the new at-rules.

It's worth noting that there are still some CSS linting errors, but they have nothing to do with the change to use Sass modules. I regard them as out of scope to this PR.

Upgraded to sass 1.23.1.
Added styleline-scss.
Adds support for Sass-specific at-rules, including the new @use and @forward directives.
Replaced all @import statements with @use.
Removed __index include for members that produce no css, like functions. Instead, the @use directive imports each member directly for each include that needs it.
@peiche
Copy link
Author

peiche commented Oct 23, 2019

I knew I'd forget something! I also wanted to mention a side effect of converting to the module system. The updated screen.scss imports each include and assigns a name, like so:

@use 'generic/_index' as generic;
@use 'elements/_index' as elements;
@use 'components/_index' as components;
@use 'blocks/_index' as blocks;
@use 'vendor/_index' as vendor;
@use 'utilities/_index' as utilities;

This is because Sass regards each import as being named "_index" by default. You could get around this by renaming each __index.scss to _index.scss, thereby allowing a simpler list of imports:

@use 'generic';
@use 'elements';
@use 'components';
@use 'blocks';
@use 'vendor';
@use 'utilities';

I've done this in my own projects, but I leave such a decision to you, as you might prefer the index of each directory to remain sorted at the top.

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.

1 participant