[gatsby-plugin-sass] Little improvements
See original GitHub issueSummary
- Use the
node-sass-chokidar
lib insteadnode-sass
to increase boost performance. - Add
sass-resources-loader
to make common resources (variables, mixins, etc) available in all Sass/Scss files in the project if you need.
Basic example
plugins: [
{
resolve: `gatsby-plugin-sass`,
options: {
...
resources: ['./path/to/vars.scss', './path/to/mixins.scss']
},
},
];
Check the documentation for more examples.
Motivation
- As a lab, I changed the package in my application during developing mode, and it decreased the RAM consumed by 15%.
- The
includePaths
param doesn’t work to make my variables or mixins available on my.scss
files.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
gatsby-plugin-sass
gatsby -plugin-sass. Provides drop-in support for Sass/SCSS stylesheets. Install. npm install sass gatsby-plugin-sass. How to use. Include the plugin in your ...
Read more >Get set up with a Gatsby, TypeScript, and Sass configuration
Until these projects don't evolve a little bit I'm going to do small modifications to the basic Gatsby. These also has the benefit...
Read more >Learning GatsbyJS. A little attempt to learn to build a…
Install and config sass with Gatsby npm install sass gatsby-plugin-sass. 3. Include the plugin in your gatsby-config.js file. plugins: [
Read more >Creating a Gatsby Site with WordPress Data - CSS-Tricks
Install the WPGraphQL and WPGraphiQL plugins. Let's start by installing a couple of plugins in WordPress. We'll use WPGraphQL to enable GraphQL ...
Read more >State Management in Gatsby using the wrapRootElement Hook
If you have any suggestions for improvements, please let us know by clicking ... I'll add Sass support with node-sass and gatsby-plugin-sass ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To auto-include some sass vars/mixins/etc. into your component *.scss files you simply can pass
data
option for node-sass with@import
. e.g: if you have common file insrc/components/vars.scss
, then use in your plugins declaration:Seems like the custom webpack config merging can combine
gatsby-plugin-sass
and custom configs, so personally I have thisgatsby-node.js
file to appendsass-resources-loader
: