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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:59:32+00:00 2026-06-18T10:59:32+00:00

I have some of my application Styles and Scripts are referred from different environment

  • 0

I have some of my application “Styles” and “Scripts” are referred from different environment applications.

  1. local-sites are referring from http://localhost:123/mystyles/default.css
  2. Dev site is referring from http://mydev.com/mystyles/default.css
  3. prod site is referring from http://prod.com/mystyles/default.css

I tried to tweak a little with cdn on bundles like below, but it didn’t help.

public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Clear();
            bundles.ResetAll();

            BundleTable.EnableOptimizations = false;
            bundles.UseCdn = true;

            if (HttpRuntime.BinDirectory.Contains("local"))
                cdnHost = "http://localhost:123/";
            else if(condition)
                cdnHost = "http://mydev.com/";
            else
                cdnHost = "http://prod.com/";

            bundles.Add(new StyleBundle("~/Content/HRO/jquery/ui/css", cdnHost)
                .Include("~/css/jQuery/hro-0079c1/jquery-ui-1.8.11.custom.css"));

            bundles.Add(new StyleBundle("~/Content/HRO/jquery/ui/css", cdnHost)
               .Include("~/css/jQuery/hro-0079c1/jquery-ui-1.8.11.custom.css"));

            bundles.Add(new StyleBundle("~/Content/HRO/base/css", cdnHost)
               .Include("~/css/base.css"));

            bundles.Add(new StyleBundle("~/Content/HRO/reset/css", cdnHost)
               .Include("~/css/reset.css"));
        }

But this doesn’t work. when I call these bundles as below

    @Styles.Render("~/Content/HRO/jquery/ui/css")
    @Styles.Render("~/Content/HRO/base/css")
    @Styles.Render("~/Content/HRO/reset/css")

I tried to debug the RegisterBundles(), looks like it is not creating those items with cdn url.

Is this a right way to create a absolute css URL for bundles?
Am I missing anything here?
Is there a better way to debug my RegisterBundles()?

  • 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-18T10:59:33+00:00Added an answer on June 18, 2026 at 10:59 am

    You need to set both EnableOptimizations and EnableCDN to true for the cdn urls to be used.

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

Sidebar

Related Questions

I have to run some other application from my program and hide it's form.
I have to modify some parts of a large PHP application. The different parts
I have a web application with bunch of HTML code. There are some style-attributes
I have some client-server application. And as one of its part, I need to
I have developed some sms application and I can't figure out how to solve
In my application,i have some .strings files.And on a button click,which is on my
in my application i have some tinymce editors and the userinput is shown with
In my application I have some link buttons there but when I right click
I have some text area field in my grails application. I got the following
I have some problem's with a simple application in JSF 2.0. I try 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.