Glenn Ferrie
Glenn Ferrie

Reputation: 10390

LessJs file not being processed in ASP.NET

I'm experiencing a peculiar issue and I'm having trouble diagnosing it.

I am using LessJs in an ASP.NET MVC web application and the less file is not being processed and I am seeing my variables in the "F12" debug tools -- and the style is not applied as expected as a bi-product.

The markup looks like this.

@Scripts.Render("~/bundles/modernizr")
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/site.less" rel="stylesheet" />
<script src="~/Scripts/less-1.5.1.min.js" type="text/javascript"></script>

I am seeing the files correctly delivered to the browser (from Network tab)

Network Traffic

There are NO errors in the console.

but when I inspect my element, I see this:

CSS error in Browser

The styles from bootstrap.css are applied as expected.

Am I missing a step? I've used less with ASP.NET before, this one's got me stumped.

Thanks!

Upvotes: 1

Views: 32

Answers (1)

Glenn Ferrie
Glenn Ferrie

Reputation: 10390

Solved. This issue was that the link tag that references the less files had an incorrect rel attribute. For less it should be stylesheet/less as opposed to just stylesheet, which is used for CSS.

<link href="~/Content/site.less" rel="stylesheet/less" type="text/css" />

Upvotes: 1

Related Questions