Motivation
While working on a site forked from gatsby-starter-decap-cms, I got very confused about why my styles weren't being applied. It turns out I was falling victim to known risks described at https://www.gatsbyjs.com/plugins/gatsby-plugin-purgecss/
NOTE: This is NOT an install and forget type plugin. By default, it may remove required styles too.
This change aims to protect others from the same pitfall by setting up a custom-styles.sass file that won't get processed by Purgecss. I also added some code comments that I would have found useful when first reading the sass files.
I chose a three-file sass setup because:
bulma-style.sass needs to be imported directly from a script file to be seen by the purgecss plugin, so I couldn't just pull it in as a dependency of custom-style.sass.
I needed variables to be visible in both bulma-style and custom-style.
Testing
The build passes
The build still celebrates a 90% reduction in CSS size
The page has no visual changes
I confirmed that unused selectors added to bulma-style.sass are still removed.
I confirmed that unused selectors added to custom-style.sass are preserved.
What kind of change does this PR introduce?
Refactor of the SASS files.
Minor configuration change to make build output more verbose.
Does this PR introduce a breaking change?
No breaking changes.
What needs to be documented once your changes are merged?
No documentation changes needed.
Motivation While working on a site forked from gatsby-starter-decap-cms, I got very confused about why my styles weren't being applied. It turns out I was falling victim to known risks described at https://www.gatsbyjs.com/plugins/gatsby-plugin-purgecss/
This change aims to protect others from the same pitfall by setting up a custom-styles.sass file that won't get processed by Purgecss. I also added some code comments that I would have found useful when first reading the sass files.
I chose a three-file sass setup because:
Testing
What kind of change does this PR introduce?
Does this PR introduce a breaking change? No breaking changes.
What needs to be documented once your changes are merged? No documentation changes needed.