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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:56:06+00:00 2026-05-26T20:56:06+00:00

I would like to configure my environment to serve css and javascript files from

  • 0

I would like to configure my environment to serve css and javascript files from static.example.com instead of example.com/static.

The second has the convenience that I can code my html pages to load the css and javascript files relatively eg “static/reset.css” independent of the actual domain.

Is there a good practice to avoid altering all my source files whenever I change

static.example.com to static.otherexample.com

as I would have to rewrite all my HTML source files importing css and javascript?

  • 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-26T20:56:07+00:00Added an answer on May 26, 2026 at 8:56 pm

    Use some kind of configurable prefix to include js and css files. Depending on the technology you’re using, it is helpful to have some kind of helper method for this. In ASP.NET MVC, I use some custom method like CSS.Add("reset.css"), which knows the path and URL.

    The js files should not really care where they are loaded from. As for css, it’s important to know that relative URLs in CSS are interpreted as relative to the URL the CSS was loaded from, not relative to the URL the page was loaded from. So make sure you understand that background-image: url('/images/img1.png') would also load from the static page (which is usually a good thing).

    The better way

    It’s best practice to compress, minify and merge all of the CSS / js files. Therefore, you should only have a very small number of files (one js, one css) to keep the number of requests low. The inclusion of these files would happen on the server, so the URLs don’t matter. To implement this, you will need some kind of helper method (and a lot of compression logic, but there are libraries for all this).

    For ASP.NET MVC there is SquishIt, but I’m sure there are plenty of tools for various environments.

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

Sidebar

Related Questions

I would like to be able to merge two files into one during configure
I would like to configure asp.net process to run under an account with domain
How can I configure the NppExec plugin for Notepad++? I would like NppExec to
Would like to know the c# code to actually retrieve the IP type: Static
I would like to provide the raw text referring to an environment variable to
I would like my application to write out different trace files named like MachineName_UserName_yyyymmdd_hhmmss.txt
I'm following the foo dissector example but would like to know how to compile
I would like to configure Java proxy settings on Solaris to use a Proxy
I would like to configure my VS2010 so that, every time a new source
I am building a website and would not like to reconfigure the website from

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.