标签:style class blog http ext com
1. 使用NuGet安装dotless
2. 在BundleConfig中配置
var less = new Bundle("~/bundles/less").Include("~/Content/less/global.less"); less.Transforms.Add(new LessTransform()); less.Transforms.Add(new CssMinify()); bundles.Add(less);
LessTransform类
public class LessTransform : IBundleTransform { public void Process(BundleContext context, BundleResponse response) { response.Content = Less.Parse(response.Content); response.ContentType = "text/css"; } }
在页面上输出
@Styles.Render("~/bundles/less")
最后在WebConfig中可配置文件压缩和缓存
<dotless minifyCss="false" cache="true" web="false" />
.net 服务器端编译less,布布扣,bubuko.com
标签:style class blog http ext com
原文地址:http://www.cnblogs.com/mricle/p/3787591.html