In my simple MVC application with only one page /Home/Index
(for now) I noticed that some of my styles are being overwritten by a mysterious type.less
:
Chrome says the file would come from
http://localhost:123/Content/less/type.less
but I couldn't find anything there.
The css
files are also included in the right order so the main.css
shouldn't actually be overriden:
The history of my actions:
I created a new MVC
project in Visual Studio 2013
and I updated all references with the nugget-manager.
Then I and changed the following files:
(I list only changes related to css
but I also added knockout
and a few custom *.js
files written by me)
BundleConfig.cs
where I added jquery-ui.min.css
:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/jquery-ui.min.css"));
and my main.css
bundles.Add(new StyleBundle("~/Content/Custom").Include(
"~/Content/Custom/main.css"
));
_Layout.cshtml
to render my new bundle and excluded the modernizr
because I thought I might be the reason (it didn't help):
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/Custom")
@*@Scripts.Render("~/Scripts/modernizr")*@
then I excluded another three lines there to make the tyle.less
go away (but it didn't work either):
<body>
<div class="container center">
@RenderBody()
</div>
@*@Scripts.Render("~/Scripts/jquery")
@Scripts.Render("~/Scripts/bootstrap")
@RenderSection("scripts", required: false)*@
</body>
Index.cshtml
contains only the title and html
@{
ViewBag.Title = "Lorem ipsum";
}
apart of this I didn't change anything else.
I was able to find a reference to the type.less
only in the bootstrap.css.map
file which is apparently minified and a long line of different styles but the file type.less
physically doesn't seem to exist anywhere. I don't understand why it wants to override my css. Do you know what might cause this and how to disable it or load it before my css
so that it doesn't distroy anything?
I found out that some strange bootstrap that is installed
by default in new MVC5 projects
Bootstrap for ASP.NET MVC
caused all that trouble. Because I wasn't able to find how to prevent it from overwriting my styles I decided to uninstall it and finally I have my styles back.
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