embedding stylesheet when you load multiple views

#1
[eluser]jtan[/eluser]
what's best practice for...

when you're going to load multiple views, like heading, main page, footer, do you have stylesheet for each view or load 1 view for stylesheet then load the other views (without stylesheet)?

#2
[eluser]kanjimaster[/eluser]
Stylesheets should be in the html header, so however many you have they shouldn't be being loaded with each view.

Whether you have one or many depends on the relative importance of maintainability and performance. Different stylesheets dealing with different parts of the site may be easier to maintain, but each requires an HTTP request from your visitors' browsers causing slightly slower page loading.

Personally I lean towards using LESS and then pre-processing, concatonating and minifying them into a single file to get the best of both worlds and there are several codeigniter sparks that can manage this for you.

#3
[eluser]jtan[/eluser]
Did I get you correctly that you're lean toward having 1 view that loads the stylesheet then succeeding views not loading any stylesheet?

#4
[eluser]kanjimaster[/eluser]
Sort of. If you have a view that loads the HTML head tag and other meta values, all your stylesheets should be loaded within that view.

Stylesheets loaded with your footer say, would be loading in a location that breaches web standards and would slow the loading of the footer as they'd require an extra HTTP request to be completed before the footer can be finished.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.