Sergei Kuleshov Sergei Kuleshov - 5 months ago 32
CSS Question

ASP.NET MVC 5, Less is very slow in debug mode

So, in our project we are using https://bundletransformer.codeplex.com/ to process LESS files. The problem is that in debug mode (on developer machines) it works soooo sloooow. I understand, that for production is doesn't matter, but it makes life of developers much harder. Some details:

In web.config we have the following line:

<add name="LessAssetHandler" path="*.less" verb="GET" type="BundleTransformer.Less.HttpHandlers.LessAssetHandler, BundleTransformer.Less" resourceType="File" preCondition="" />


Bundles are rendered using

@Styles.Render("~/assets/css/fileupload-css")


So when I look at page in Chrome Dev Tools, I see the following picture:

enter image description here

As you can see, it takes more than 3 seconds just to receive 304 back..
Weird problem is that: if right click on a line in network tab and open it in the new tab, it works super fast (49ms).

Does anybody know, how to speed it up? And could anybody tell if it's a problem in bundler, or it's by design, or something else?

Thanks.

Answer

So, the answer is this:

in web.config this thing has setting, which enables/disables cache. Just turning cache on solved the issue.

Before:

<assetHandler disableServerCache="true" disableClientCache="false" />

After:

<assetHandler disableServerCache="false" disableClientCache="false" />
Comments