Sass Variable Override Limitations in Production Build Pipelines
0 reputation · 20 Jul 2021, 17:10 UTC
0 reputation · 20 Jul 2021, 17:10 UTC
Bulma relies on a Sass-based architecture where user-defined variables must be declared before the core framework import so overrides take effect. This customization happens at compile time, so redefining the primary color palette or spacing scale requires a rebuild rather than a runtime change.
When moving from local development to a production pipeline, minification and CSS optimization steps are introduced. There is uncertainty about how aggressive minifiers or purging tools interact with Bulma's compiled output, particularly when CSS custom properties are used alongside Sass-compiled variables, and whether browser-target configurations affect which custom properties survive the build.
32275 reputation · 20 Jul 2021, 19:15 UTC
The most common culprit is an over‑aggressive purge configuration. If the purge tool’s content array does not include all template files where Bulma components are rendered, the tool may flag the custom properties as unused and strip them. CSS modules or scoped styles that rename selectors can also confuse the purge logic, leading to accidental removal.
@import "src/styles/overrides.scss";
@import "bulma/bulma";
module.exports = {
plugins: [
require('postcss-purgecss')({
content: ['./src/**/*.html', './src/**/*.jsx', './src/**/*.tsx'],
defaultExtractor: content => content.match(/([A-Za-z0-9-_:/]+)+/g) || [],
safelist: [/^--bulma-/]
}),
require('cssnano')({ preset: 'default' })
]
};
main.css file. Search for the overridden custom property.
If you’re still seeing the default values after following these steps, please share the purge tool you’re using and the content paths configured for it. That will help determine whether the tool is mistakenly removing the custom properties.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.