简体   繁体   中英

BundleConfig is bundling the old versions of my CSS files

I'm working with c# in MVC4, and I have a weird issue with my CSS files. Everything is working perfectly in localhost. The changes that I do in the CSS file are working. Problem comes when I publish my project to the hosting server, where the bundle file created by BundleConfig.css is the old version.

Here you can see one of the examples :

In my piece of code, there's the new line, and the old one commented.

After that, you can see the styles in my localhost, and in the end, the styles in the hosting server.

BundleConfing is using the old version where I still have 50px as min-height.

Some time it can be caused if you have minimized version of css and not minimized version of css in the same folder.

Let's say you have following structure

~/Content/your.css
~/Content/your.min.css

in your folder, and you registered the "your.css" file in bundle, then optimizer will try at first to use the "your.min.css" file in time of publishing. If you modified only "your.css" and didn't modify "your.min.css" then you'll get old styles from "your.min.css". You can modify "your.min.css" or remove it. This is not the case during debug because compiler as usually has the following configuration:

<system.web>
    <compilation debug="true" />
    <!-- some more lines -->
</system.web>

Also you can kill web.config setting with the following line:

BundleTable.EnableOptimizations = false;

That are my assumptions. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM