E
E
Evgeny Vlasov2016-07-25 00:10:57
css
Evgeny Vlasov, 2016-07-25 00:10:57

Should css be split into multiple files?

I am currently writing a website. The site will have several information pages (i.e. with the same template), and quite a lot of pages in the form of landings. And it turns out that each of these landing pages has its own css for design.
So, the question is how best to do it:
1) Write all the styles in one css file, and it will be used on all pages
2) Make one css file with some common styles, and also for each landing page its own css -file
3) Maybe there is another option?
I hope that I have explained the situation clearly. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Stroykin, 2016-07-25
@gamer25

One common css file for common styles and additional css for each individual landing page. This way it will be easy to maintain everything and, if possible, easy to remove / add.
Well, on "production" it was not bad to "minify" all css

A
Alexey, 2016-07-25
@Hubble

general embed in html, and those for individual pages should be put into separate files

I
It, 2016-07-25
@IT_Highlander

Имхо, зависит от частоты и объема страниц. Если все отдельные лендинги это самостоятельные разделы, информационно не связанные с друг другом и если пользователь в большинстве случаев ищет только один из этих разделов и по другим не переходит, то нужно делать один общий файл normalize, как написали выше, и отдельные для каждого лендинга. Как минимум уменьшишь объем килобайт скачиваемых пользователями.
А если лендинги связаны между собой информативно и по ним пользователи прыгают, то делать один.
Я бы в любом случае начинал использовать сборщик и методологию. Разбивай как хочешь файлы, по любому принципу, а в продакшен пойдет только один и уже оптимизированный.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question