Load only necessary css

Hello @all :slight_smile:

I have a thought i want to share with you.

At the moment i have the problem that i have one big css file, compiled from scss files for every snippet.

When i now have a page with only one snippet - the most of the css isnt needed.

Is there a way to compile the css(scss) for every page with only the needed css for what actually is on the page?
The result would be an own css file for every page.

Best
Marvin

The question is if that would actually make sense, since a CSS file is cached by the browser, so is only loaded once.

If you have CSS that is only needed for specific templates, you can make use of Kirby’s @auto parameter that can be used with the css() and js() helpers.

You can see that approach in Kirby’s Starterkit:

1 Like