fredtbx Posted December 27, 2016 Share Posted December 27, 2016 Hi, I'm adapting a new site from Ex1, but have a question. What is the best way to include css on a script that includes the header.html file, but wants to use additional css on the rendered page. Seems that if I want to use different css on each script it would clutter up the header.html, could have 100 different css files included in header.html but just one at a time being used. TIA Link to comment Share on other sites More sharing options...
Larry Posted December 31, 2016 Share Posted December 31, 2016 Interesting question! Generally speaking, the trend is really to use a couple (1-3) CSS sheets across every page with the expectation that your visitor will visit multiple pages and the initial extra download is covered by the caching benefit. (To be clear, those 1-3 sheets would define all the CSS needed by every page even if every page doesn't need every thing.) Moreover, the idea that you might need more than, say, 5 different style sheets for a site sounds problematic, unless the site has multiple distinct sections. All that being said, a solution here would be to define a variable on a page that identifies an additional CSS file that's required. Then your header.html would check for that variable and if it has a value, include that CSS file, too. Link to comment Share on other sites More sharing options...
Recommended Posts