Ramesh Kannan
Ramesh Kannan

Reputation: 1098

Will performance improve/decrease if I directly refer LESS in html?

I'm using LESS CSS and Dot Less in my ASP.NET MVC project.

I'm directly referring LESS using bundles

bundles.Add(new LessBundle("~/styles/templates").Include("~/Content/Stylesheets/Templates.less"));

But this link saying if we use less.js in the html it will degrade the user performance. But i'm not using less.js in my project.

I've the following questions.

  1. Shall I refer the less bundle directly in page?
  2. If I refer LESS bundle directly, will it increase the performance?

Upvotes: 0

Views: 84

Answers (1)

Bass Jobsen
Bass Jobsen

Reputation: 49044

You can not compare client side in browser version of less.js with Dot Less and bundle. The in browser version of less.js compiles your Less code client side (and does that again for each page request) and should not be used for production. DOT Less compiles your Less code server side and bundle ensures that only the compiled CSS code loads in browser. Less code will only be compiled once and the compiled CSS will be used for each page request. You definitely should read: http://www.asp.net/mvc/overview/performance/bundling-and-minification

Use in your pages @Styles.render("~/styles/templates") this should not influence your performance.

NB consider using http://bundletransformer.codeplex.com/wikipage?title=Bundle%20Transformer%3a%20LESS cause it uses a newer version of Less.

Upvotes: 2

Related Questions