[英]Running LESS server-side vs. client-side
What are the advantages / disadvantages to running the LESS framework client-side vs. server-side? 运行LESS框架客户端与服务器端的优点/缺点是什么? Does page load time take a hit if you run it client-side? 如果您在客户端运行页面加载时间会受到影响吗?
On the server, you have to take more care with your cache control headers and you sacrifice a bit of CPU power. 在服务器上,您必须更加小心缓存控制标头,并牺牲一点CPU功率。
On the client, it breaks if JS isn't available. 在客户端,如果JS不可用,它会中断。
(For your production systems,) do it at build time and just serve up static CSS. (对于您的生产系统,)在构建时执行它,并且只提供静态CSS。 That's efficient and reliable. 这是有效和可靠的。
Using ASP.NET MVC 4.0 Bundling you can use: 使用ASP.NET MVC 4.0 Bundling,您可以使用:
var bundle = new StyleBundle("~/Content/style").Include(
"~/Content/myStyles.less");
bundle.Transforms.Add(new LessTransform());
bundles.Add(bundle);
Everything will be handled very nicely. 一切都将得到很好的处理。 Caching, Transforming (server-side), bundling and ... 缓存,转换(服务器端),捆绑和...
Advantages: 好处:
Disadvantages: 缺点:
Advantages: 好处:
Disadvantages: 缺点:
Never ever use client side in production. 永远不要在生产中使用客户端。 In development it may however be very useful to compile less client side. 在开发中,编译较少的客户端可能非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.