Easy CSS Concatenation: How To Keep Your Sanity
There are instances where concatenating content files into a singular top-level template becomes beneficial. For example, merging all component CSS into a single CSS file might be a preferred approach.
Add this to your main stylesheet in the "src"
folder ("style.njk"
renders as "style.css"
):
---
permalink: style.css
---
{% include "components/header.css" %}
{% include "components/footer.css" %}
That's it! 🤣 Like I said, it's crazy simple but saves you a ton of time and keeps you organized. I try to implement this in every project.
Keep all your separate CSS files for every dedicated module in the "_includes"
folder and add partials accordingly.