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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:35:45+00:00 2026-05-22T14:35:45+00:00

When you serve JavaScript to a page it is best to serve one packaged,

  • 0

When you serve JavaScript to a page it is best to serve one packaged, minified and gzipped file to reduce latency and request times.

But is it better to send

  1. One big package for your entire website
  2. One big package for each page in your website.
  3. CDN I don’t want to load from a CDN

With 1. you get load more on the initial load but then all your javascript is cached for the entire visit to your website.

With 2. you load only as much is necessary for a page so the initial load time is reduced but you don’t have the same file cached on every page in your website.

Which method is preferred?

I’m using node.js to serve my JavaScript and I’m using ender to package my JavaScript.

Edit

Phrased differently I’m thinking of implementing an automation on my packaging. This automation will either package everything into one file for my entire website or package a page specific list of files into one file for each page.

I don’t have any statistics on my JavaScript files yet but I was curious as to which of the two automations I should implement.

  • 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-22T14:35:46+00:00Added an answer on May 22, 2026 at 2:35 pm

    Option 1 is tenable.

    Option 2 is a bad idea (for the reasons you specify).

    You’re missing option 4, which is to have a one large core package, with instance updates (secondary javascript includes) as necessary… no reason to load your Google Maps code on every page, when you only need it here and there, for instance. But there’s also no reason to re-serve your ‘core’ packages.

    This is generally the option I use. When speed is super-important, I use a subdomain which has just about everything stripped out of the apache (no sessions or cookies, php, etc). I actually have one server which acts as a central static repository for all of my clients and an extra A Name record in the DNS for ‘static’ using virtual domains.


    Added: In response to your edit, I think the most appropriate thing is to have a list of files that need to be globbed together in your automation. Instead of taking ‘everything’, just take all of the items in a ‘to_pacakge’ array.

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

Sidebar

Related Questions

I have Javascript updating my URI as below: /index.php?page=list#page=news But I would like to
My Javascript needs to send some data to a server when the page closes,
I used to do the following to execute javascript from the server: Page.ClientScript.RegisterStartupScript( ...
I'm aware of server-side javascript for a long time now, but I don't have
I've created an ashx page which is going to serve me an XML document
I am trying to figure the best way to manage my javascript code for
What is the difference between those three code samples here below? Is one better
This question is similar to the one i asked here . But its related
I have a view using a master page that contains some javascript that needs
This may seem simple to some but I am less experienced with JavaScript. 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.