Dotless HttpHandler with VS2013 Preview
Asked Answered
V

1

5

I have just installed the Visual Studio 2013 preview and run up my site. I've noticed that the less files which are used in my site are not being correctly transformed to css and are coming down as blank CSS files.

It appears something is going wrong inside the dotless httphandler as when I force minification for the bundle everything works correctly.

web.config

<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
...
<httpHandlers>
  <add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
...
<handlers>
      <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>

The issue appears to go away if I force minification eg. System.Web.Optimization.BundleTable.EnableOptimizations = false; which suggests something is different in the way it processes the HTTP handler

Vento answered 29/6, 2013 at 0:22 Comment(3)
Your LessTransform looks a bit simple...Raver
@Raver The one im currently using seems to work fine, however i tried the one you linked to which is probably more robust and it has the same issueVento
I am encountering the same issue with VS2013 in an MVC 5 project. On the same machine in VS2012 with MVC 4 I get my LESS compiled without issues.Kentkenta
P
7

Try putting handleWebCompression="false" in the configuration for dotless (in the web config)

  <dotless minifyCss="false" cache="true" web="false" handleWebCompression="false" />
Pelligrini answered 30/6, 2013 at 6:55 Comment(4)
that seems to work perfectly, any idea why this only happens in 2013?Vento
The problem seems to be with assigning GZipStream as a response filter. I didn't dig too much deeper than identifying which line caused the problem: github.com/dotless/dotless/blob/master/src/dotless.AspNet/… (line 69)Pelligrini
Where in web.config do you place this?Malcommalcontent
github.com/dotless/dotless/wiki/Using-.less explains what needs to go into the web.config (although, if you use the nuget package, this is all added for you). You just need to locate or add the dotless section, and add the handleWebCompression attributePelligrini

© 2022 - 2024 — McMap. All rights reserved.