Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kris01's avatar

One css file or multiple

Hey guys, Is it better to have one css file for all the blade files, or one css file for each blade? What's more efficient?

0 likes
4 replies
jlrdw's avatar

Depends on project. Some I have one, others I have several.

tykus's avatar

One minimised CSS file in production IMHO - because caching minimises requests. If you prefer to develop using multiple independent CSS (or SASS, SCSS, LESS etc), then any build process can combine them for production.

martinbean's avatar

@kris01 Why on earth would you have a CSS file for each “blade”?

Surely your site or app has a common look between all pages. The same header, footer, etc. The same styling for headings, the same styling for paragraphs, and so on.

Tray2's avatar

Like others have already said, it depends. If you use Tailwind then you have only one CSS file, but if you write custom CSS, then all the common CSS rules should be in a single file, and hopefully all of them are common rules. If there are any pages specific rules, and I mean not just a handful, but rather thousands of them, then it might be worth it to keep that CSS in a separate file, but with some minifying and compression there isn't any real need to keep it in it's own file for quicker loading, the cache takes care of that for you.

Please or to participate in this conversation.