Posterous theme by Cory Watilo

Getting .LESS 1.0.0.4 run on your machine

Today I set out to play around with .LESS with the goal of deciding if it was something we should bring into our toolkit at work. I downloaded the current version, which at the time of this writing is an assembly with the version 1.4.0.0, and set out to configure our site to use it. The configuration it pretty straight forward, the instructions are at the first page of the .LESS domain, in a 5 step list. However, this is where things deviated from the intended path.


The first obstacle I ran into was Visual Studio telling me that it did not recognize the dotless.Core assembly I pointed it to, for the new configuration section handler I was adding. This was quickly resolved as it turns out that the setup instructions had not been updated to reflect the latest assembly version 1.0.0.4. So changing the section handler registration from

<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core, Version=1.0.0.1, Culture=neutral" />

to

<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core, Version=1.0.0.4, Culture=neutral" />

Unfortunately after creating a .LESS file and running the application resulted in no styles being applied. When I tried to directly navigate the .LESS file by typing in the path in the browser address field, I got an ASP.NET error page informing me that the file could not be found at c:\css\main.less. This turned out to be a bit more difficult to resolve.


After moaning about this on Twitter, one of the developers, Erik van Brakel, on the .LESS project suggested I should have a look at the .LESS Google Group since he believed someone found a solution to this before. I found a post talking about a feature request that looked like it could have something to do with my issue. In one of the posts another of the .LESS developers, Daniel Hoelbling, linked to a blog post on some changes he had made to accommodate the new feature.


This blog post gave me the hint I needed to figure out how to solve my problem. Turns out that the custom configuration section that .LESS uses, now supported a new attribute called source. This tells .LESS how to resolve the location of requested .LESS files. However there were a slight error in the statement by Daniel, that stated that the AspServerPathSource source engine was the new default instead of the FileSource engine.


What I found was that unless I explicitly configured that the AspServerPathSource should be used, .LESS resorted to using the FileSource engine which was the cause of my problem. So by updating my configuration to

<dotless minifyCss="false" cacheEnabled="false" source="dotless.Core.AspServerPathSource"/>

everything started to work like intended. I am now able to use the (currently) latest drop of the .LESS binaries. I’ve told Erik about this so hopefully the documentation should be updated to reflect the changed I have come across.

Media_httpdotnetshout_gcimp
| Viewed
times
Filed under: