1

Recently I started to experiment with LESS, and Im really enthusiastic about it. Its a really nice tool to optimize css. Anyway I installed into my project file as it was written on their website 4 steps, very EZ. I use MVC3 framework with razor engine, and in my view I just can not apply the .less files as a css for the browser.

When I used like this, its just worked brilliantly

 <style type="text/css">
       @Less.Parse(".transparency(@opacity: 50) {opacity:@opacity/100; filter:~'alpha(opacity = '@opacity~')';}.disabled {.transparency}")
 </style>

But when I tried to apply it as a css file the browser just ignored it

<link rel="stylesheet/less" type="text/css" href="/Content/Css/Pm/Pm.less" media="screen" />

I had no compiling error in my less file, and the compiled less just looked great, I thought dotless going to handle it automatically, but apparently thats not the case. Im not sure what would be the best approach, read out the less file content as a stream and write it back into a css file or modify the view engine like int this article or write a helper like this?

madth3
  • 7,275
  • 12
  • 50
  • 74
JahManCan
  • 601
  • 3
  • 8
  • 19
  • This might answer your question... http://stackoverflow.com/questions/4081084/less-together-with-razor – codefrenzy Sep 15 '11 at 08:48
  • I dont want to use squish it. That uses too much cpu power, any other suggestions? – JahManCan Sep 15 '11 at 11:40
  • Could you detail what kind of environment you are using? Are you running on the asp.net dev server? In any case please post the relevant httpHandelers section from your web.config. – Tigraine Sep 25 '11 at 08:06

1 Answers1

1

If you are concerned about CPU usage, you could always look at using precompilation, take a look at this question: Visual studio - precompile - dotless

The answers give a number of options:

Community
  • 1
  • 1
Paul Tyng
  • 7,924
  • 1
  • 33
  • 57