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 1072099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:48:36+00:00 2026-05-16T20:48:36+00:00

I have a single huge minified JavaScript file (ditto for CSS). I am looking

  • 0

I have a single huge minified JavaScript file (ditto for CSS). I am looking for some optimization in terms of speed of download and caching. I want to set the expiry headers for both these files such that with only 2 HTTP calls I get them (and until I change their version number in the URL) want them to be cached. My question is –

  1. Where do I set expiry headers? Do I need to set it as part of response to each request? Or do I need to set it in the web server settings?
  2. How do I compress these files (JS and CSS)? Where and how do I specify it? Is it normal .zip or .tar.gz compression? If so would the normal browser at the other end unzip it and use those scripts?
  3. Can it be possible to put both the JS+CSS in a single file, minify and compress it? So that I can get by with a single HTTP request? Would this work? My guess is not, since JavaScript runs by <script> tag and CSS runs by <link> tag. But still, could this line of thought be explored? Maybe one could use Javascript itself to dynamically insert CSS into the DOM after it loads. But what kind of impact will this have on the page load. Since browsers apply CSS to DOM before any Javascript execution.

Any help, suggestions are welcome…

  • 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-05-16T20:48:37+00:00Added an answer on May 16, 2026 at 8:48 pm

    First off, you’re already on the right track using a version number in the URL. (I assume it’s not in the query string, but in the actual resource path.) V. smart.

    Answers to your direct questions:

    1. In your web server configuration.

    2. In your web server configuration; you should have the option to enable gzip compression, at which point with modern servers it Just Happens(tm).

    3. Yes, but you probably don’t want to. You can embed CSS inside a JavaScript file as a bunch of string literals and then output a style element when the page loads (not via document.write, that would kill your apparent page load performance, but via DOM methods). But that would be a problem if JavaScript is disabled on the client. 🙂 There might be rendering delays as well, and in any case, you’re probably not gaining enough to make the complexity worth it.

    Other things to consider:

    • If your site sets cookies, you want to avoid serving the JS and CSS from a path that the cookie will be sent back to, because the presence of the cookie in the request can defeat some caches. That’s why you frequently see these sorts of resources loaded from a different domain or subdomain.
    • Look at JS and CSS minifiers, if you haven’t already — you know, things that remove unnecessary whitespace, that kind of thing.
    • Look at using a CDN for your JS and CSS if you’re this concerned with speed. They’re a lot less expensive than they used to be. This is a fun place to look at them: http://cloudharmony.com/speedtest So far (it’s early days) I’ve been very impressed with MaxCDN‘s $39.95 intro (normally $99).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge access mdb file which contains a single table with 20-30
I have a database containing a single huge table. At the moment a query
I have one single file called Exercises.rb def ask(prompt) print prompt, ' ' $stdout.flush
I have a huge web app in Javascript and its starting to become something
I have multiple .csv files and I combined them in single .csv file with
I have a huge form that has around 110 fields columns (single row) that
right now I have a huge Solution in which we use javascript alerts via
I have huge table with 1 million records, i would like to modify some
I have a fairly huge database with a master table with a single column
I have a 10GB CSV file which is essentially a huge square matrix. I

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.