Install
Tools –> Library Package Manager –> Package Manager Console
Tools –> Library Package Manager –> Package Manager Console
PM> Install-Package dotLess
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/less")
@Scripts.Render("~/bundles/modernizr")
</head>
And add your bundle to the appropriate location within BundleConfig.cs
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
// NOTE: existing bundles are here
// add this line
bundles.Add(new LessBundle("~/Content/less").Include("~/Content/*.less"));
}
}
dotLess will apply transforms to your web.config when you install it
through NuGet to provide handlers which can process a specific LESS
file:
---------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<!-- these probably do something useful -->
<dotless minifyCss="false" cache="true" web="false" />
<system.webServer>
<handlers>
<!-- for IIS7+ -->
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<!-- for IIS6 -->
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
</system.web>
</configuration>
-----------------------
Or Follow this Link
http://www.brendanforster.com/blog/yet-another-implement-less-in-aspnetmvc-post.html
No comments:
Post a Comment