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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:23:41+00:00 2026-06-05T02:23:41+00:00

I guess what I’m asking is that if grouping JavaScript is considered good practice,

  • 0

I guess what I’m asking is that if grouping JavaScript is considered good practice, why don’t more websites place the JavaScript and CSS directly into one HTML document?

  • 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-05T02:23:45+00:00Added an answer on June 5, 2026 at 2:23 am

    why don’t more websites place the JavaScript and CSS directly into one HTML document

    Individual file caching.

    • External files have the advantage of being cached. Since scripts and styles rarely change (static) and/or are shared between pages, it’s better to just separate them from the page making the page lighter.

      Instead of downloading 500kb of page data with embedded JS and CSS, why not load 5kb of the page, and load from the cache the 495kb worth of JS and CSS – saves you 495kb of bandwidth and avoids an additional 2 HTTP requests.

    • Although you could embed JS and CSS into the page, the page will most likely be dynamic. This will make the page load a new copy all the time, making each request very heavy.

    Modular code

    • Imagine a WordPress site. They are built using a tom of widgets made by different developers around the world. Handling that many code stuffed in one page is possible, but unimaginable.

    • if some code just short circuited or just didn’t work on your site, it’s easier to take out that code linking the external file, rather than scouring the page for the related code and possibly accidentally remove code from another widget.

    Separation of concerns

    • It’s also best practice to separate HTML from CSS and JS. That way, it’s not spaghetti you are dealing with.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I guess that the # Net column is the most interesting, although I don't
I guess this is more about SEO than wanting to support browsers with Javascript
Guess that I have a TextView that I want to update it in some
My guess is that <br> might be inline and that <hr> might be block.
I guess I don't give title nicely, anyways, I can explain it better here:
I guess I still don't get git as I'd hoped... I was creating a
Guess this is a pretty simple problem. I've got a regex and php that
I guess this have been both asked and answered before, but I don't really
I guess I'm looking more for advice than any specific coding solutions. Here's the
I guess I already know the answer but may be there is a good

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.