theark
theark

Reputation: 339

Less files not converted to css when publishing the project in ASP.NET

My problem is am unable to compile .less files to .css using dotless in production server. I installed the dotless package using Nuget in Visual Studio 2010. Its working fine locally. No css file is generated.

When i see the view source, i see the following in the head section of the page:-

<link href="/MyProjectFolder/Content/styles?v=" rel="stylesheet">

and there is no content displayed when i click on this above link as the file is not generated.

Can anyone help me in resolving this issue.

Update 1: Mentioned the approach by which am calling the less files

Am using the bundling of less files by using the following code in the BundleConfig.cs file as:-

bundles.Add(new StyleBundle("~/Content/common").Include("~/Content/common.less"));

and in my html page in the head section I call it using

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

My common.less file also has reference to two other files, using import. So the common.less file would like:-

@import "variables.less";
@import url(http://fonts.googleapis.com/css?family=Roboto);

body{
 background-color: @body-bg;
}

..and so on

Upvotes: 1

Views: 3184

Answers (2)

Konard
Konard

Reputation: 3024

Another way to solve this is to remove dependency on dotLess and use free Visual Studio Extension https://github.com/madskristensen/WebCompiler for precompilation of less to css (with and without minification).

Upvotes: 1

Ben Foster
Ben Foster

Reputation: 34800

It doesn't look like you are adding a bundle transformer to compile the LESS files.

Please see the documentation here under "LESS, CoffeeScript, SCSS, Sass Bundling."

Upvotes: 1

Related Questions