1

Layout page in my MVC project displays the following code:

@Styles.Render("~/Content/css")

I also read that this will ask for the files defined in the RegisterBundles method (in the BundleConfig class in the App_Start folder to be precise).

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));

But somehow my changes in Content/bootstrap.css won't go through. My MVC project only renders the Content/bootstrap.min.css, only changes in that file will change the styling of my MVC project. Can anyone explain me or direct me somewhere I can read about how changing CSS code in MVC works? Is it necessary to always change the bootstrap.min.css? I thought there must be some other way to change CSS code.

2
  • Have you tried refresh your browser cleaning the cache (with ctrl f5)? Commented Nov 19, 2015 at 14:14
  • Yes I already tried doing that. Commented Nov 19, 2015 at 14:15

2 Answers 2

3

ASP.NET Bundling will use a min.css file if it exists as this is quicker for on-the-fly bundling as no dynamic minification is required.

Therefore either remove your .min.css file, or ensure this is updated whenever your .css file is.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah I think this is what is causing my question then. Thank you!
1

You can add this line:

BundleTable.EnableOptimizations = false;

in the Application_Start() of your Global.asax.cs file. This will disable the automatic using of the minimized files.

You can see more about this from here.

3 Comments

This will also remove minification in general, and bundling. BundleTable.EnableOptimizations = false should only really be used in dev, otherwise theres no point using BundleConfig at all.
@Curt Well, in dev mode this is enabled by default, since you can assume that compilation debug="true"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.