binokochumolvarghese / lightbi-hugo

Lightbi is a minimal and clean blog theme for Hugo.
https://lightbi-hugo-theme.netlify.app/
MIT License
64 stars 36 forks source link

Use SASS to combine all CSS code into one file #49

Closed palant closed 5 months ago

palant commented 5 months ago

The main objective of this change is improving performance – rather than loading six CSS files (more with custom CSS), the website will load only one minified CSS file containing all the code. Custom CSS can be added by overriding theme’s assets/css/custom.scss.

Sass syntax does have some nice features however. In particular, it allows grouping related selectors in a single block which helps readability a lot. I’m not using any special syntax here yet, the files are merely renamed.

I would have preferred not executing main.scss as a template and rather exposing .Site.Params to it as Sass variables instead (see vars option). However, Sass doesn’t currently support conditional imports. So deciding what to import based on these variables wouldn’t be possible.

Note that various Bootstrap CSS files are still being placed into the vendor directory. This can be avoided by placing the files used under assets and removing the unused files.