So I am new to ASP.NET MVC 4 (well, I used 3 a little).
Anyway, in my BundleConfig.cs file, I am trying to load the Twitter Bootstrap css files and an additional site.css
file.
But only the site.css file is rendered. I have confirmed that the bootstrap css files are indeed in the right place (Content folder) and are in the same location as the site.css
bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.min.css", "~/Content/bootstrap-responsive.min.css", "~/Content/site.css"));
EDIT
OK, this isn't my preferred way but Andrei Drynov recommended I try:
@import url("bootstrap.min.css") body{background: #e8e6da;padding-top:60px;padding-bottom:40px;} @import url("bootstrap-responsive.min.css")
But that doesn't work. I changed the site.css to the above but now the background body color doesn't even work. If I remove the @imports the background is the correct color.
EDIT 2
I don't get it but adding:
bundles.IgnoreList.Clear();
To my bundles file fixed it. Hmmm. Not sure I understand. But I was able to remove the @imports out of the site.css.
Strange.
Bundling and minification is enabled or disabled by setting the value of the debug attribute in the compilation Element in the Web. config file. In the following XML, debug is set to true so bundling and minification is disabled. To enable bundling and minification, set the debug value to "false".
Bundling is one of the features of MVC. By implementing this, we can improve performance request load time. Minification is the process of removing unnecessary data without changing its functionality such as removing white spaces, comments, converting the large variable names to small, etc.
To optimize the performance of an application I found that bundling and minification can significantly improve the performance. It can be applied on MVC as well as in ASP.NET web forms.
Bundle Types ScriptBundle: ScriptBundle is responsible for JavaScript minification of single or multiple script files. StyleBundle: StyleBundle is responsible for CSS minification of single or multiple style sheet files.
The default behaviour is for the IgnoreList to ignore any minified scripts.
You can either remove the '.min' from their names, or clear the IgnoreList.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With