Reputation: 91620
I have a static site setup with Jekyll. I'm compiling multiple SCSS files into a single style.css
output file.
In local development, I'd like this file to be expanded so as to make it easier to debug. In production, I'd like this file to be minified.
It seems that the only way to set the SASS compiler to do minification is to hardcode the value into _config.yml
.
Is there a way for me to vary the SASS compilation output style based on JEKYLL_ENV
?
Upvotes: 2
Views: 558
Reputation: 2871
You could use an additional config file to override the compressed
style on development with the --config
option, and ignore it on production (https://jekyllrb.com/docs/configuration/#build-command-options).
_config.yml
:
sass:
style: compressed
_config-dev.yml
:
sass:
style: expanded
sass.style
can be nested
, compact
, expanded
or compressed
.
Development:
bundle exec jekyll serve --config _config.yml,_config-dev.yml
Since the dev file is last, its options overwrite the default.
Production:
bundle exec jekyll build
Upvotes: 4