Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7723939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:34:11+00:00 2026-06-01T04:34:11+00:00

I am considering replacing a number of static css files with style tags dynamically

  • 0

I am considering replacing a number of static css files with style tags dynamically generated from JavaScript. My purpose is not to build a stylesheet for the whole document, but rather to use it for plugins that get added to the page, like tabs, slideshows, etc. The stylesheets I currently deal with have 10 to 20 lines.

I see several benefits:

  • load only a js file instead of both js and css
  • ability to define theming on the fly (e.g. enter colors as variables)
  • ability to define selectors on the fly (e.g. namespaced class names)
  • add browser specific styles

What would be the drawbacks of this approach? Could you recommend any good references on this topic?

I did some research and found the following tools:

  • less – but still requires to load a separate stylesheet
  • DiceJS (apparently a new library)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:34:13+00:00Added an answer on June 1, 2026 at 4:34 am

    Another benefit would be that each additional asset that is loaded in the page slows down the overall page load because a browser is typically only loading 4 assets simultaneously at a given time.

    However, doing all of that combining on page load is likely to cause the page to slow down just as much from the processing alone… depending on how many things it needs to iterate through to make up the final css block.

    In terms of performance, it seems very unlikely to me that javascript is going to elegantly / efficiently replace the styles that would’ve been included in a combined css file.

    The other thing is that in production environments, you also can do another option which is to use a library to pre-generate a set of minified, optimized, (and obfuscated in the case of JS) code and then have 1 js file and 1 css file loaded at the time of page load, which in-turn you’d cache for speed/loading benefits. Boilerplate lib has a script for this i think.

    End of the day: energy is neither created nor destroyed — your optimizations in one place and hurt you elsewhere if you’re not careful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider the following: I am storing around 1.2 Million TIF files ranging from
I am considering replacing links with such as: <input type=button onclick =window.location.href('http://foo.com') value=Click me!
Considering the following (pointless, but it's for illustration purpose) test class : public class
In considering a 1NF failure, no repeating groups of elements, what if you wanted
Considering such code: class ToBeTested { public: void doForEach() { for (vector<Contained>::iterator it =
Considering private is the default access modifier for class Members, why is the keyword
Considering this code, can I be absolutely sure that the finally block always executes,
Considering the following architecture: a base object 'Entity' a derived object 'Entry:Base' and a
Considering the criteria listed below, which of Python, Groovy or Ruby would you use?
Considering a large system with hundreds of assemblies, what is the easiest way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.