Built-In Sass Support
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
With #8626 it was commented that the various non-css-in-js styling plugins would be deprecated in favor of built-in support. This did not happen, and my tests with the new built-in CSS support and @zeit/next-sass
even showed Sass to outright fail in cases.
Describe the solution you’d like
Installation of node-sass
should enable built-in Sass support, both global and CSS Modules per the original RFC suggestion.
I’ve created PR #10133 (as a start) which modified the CSS webpack config to enable .scss
, .sass
, .module.scss
, and .modules.sass
. It adds sass-loader
as the only additional dependency.
Describe alternatives you’ve considered
I’ve considered rewriting @zeit/next-sass
to cooperate with the current built-in CSS and CSS Module config. This would come with the benefit of not requiring sass-loader
as another core dependency, but would require a complex setup to gain the same level of benefits, further user config, prolonged maintenance of the plugin, etc.
Additional context
- Tests focusing on Sass need to be written, but many of the tests for output CSS should work for Sass tests.
- Documentation will need to be updated to remove
@zeit/next-sass
references and include instructions for installingnode-sass
to enable. - Some additional refactoring may be able to DRY up repetition, but I also didn’t want to make individual configurations more difficult by abstracting too much. Because of this some comments from the original implementation are a bit redundant in the sass-loader.
- Error messages skew towards “CSS” verbiage. There could be custom Sass messages, but I think this increases the footprint unnecessarily and Sass becomes CSS so I feel the messages work.
Let me know if this is the correct path forward and if you’d like me to continue contributing towards this feature.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:26
- Comments:16 (9 by maintainers)
How can we set any sass loader options like
includePaths
?This feature has been experimentally landed. Please try it out on the latest canary!