SmoothFriction.nl

posts - 39, comments - 20, trackbacks - 0

Less.NET update

After my previous post I’ve had some feedback and help (thanks @Tigraine!), which led me to ask myself the next question. Why not simply host the ruby code in a IronRuby container, calling the ruby code directly? This would, indeed, make my life a lot easier. However, seeing my third point, I think it’s a valid reason to keep going down the path I’m on right now:

“Third, and perhaps the most important reason: I want to learn. Parsing CSS is a nice way to learn how to parse a DSL using Antlr, something I wanted to try for a while. Little did I know that CSS can get pretty complex when adding all those little, unknown, hardly supported features that are in CSS3… I also wanted to get some hands on experience with running an open-source project, although I don’t know if I’ll really get the community input I’m hoping for.”

I want to successfully manage to completely write this in C#, so I will be able to say: “Yes, I know Antlr. See this LessCSS parser? I made it!”.

I’ve also been thinking about advanced scenarios for the library. Having the full CSS structure as an object tree in memory is a pretty interesting thought. How nice would it be to be able to programmatically change some parts of your CSS, based on environment variables? A very silly example: You could have your colors change depending on the time of day, without having to resort to javascript or having different stylesheets. A better example would be the ability to skin your application using user settings. Using (Less)variables for your colors, you can load the stylesheet into your app, replace the variables and BAM! user based skinning without much effort! I think THAT is the way I want this to go.

However!

I think, from a usability standpoint, it would be good to incorporate such an implementation (IronRuby container) into the solution. Why? Because then people should be able to use the HttpHandler right away. Simply hotwire the handler in the web.config, throw in some *.less files and go for it! So that will be part of my adapted roadmap for the first release. Instead of having a full C# port, I want to have a working version which doesn’t need ruby installed. Whichever way to go, if it works, it works!

Print | posted on Monday, August 17, 2009 2:02 AM |

Feedback

Gravatar

# re: Less.NET update

I was just about to email you about this.

I finally got the DLR host to run the original LessCss and am right now doing the finishing touches to make it work as a HttpHandler.
Unfortunately running LessCss inside a DLR host is painfully slow. Less is reaching out to so many other Ruby modules that the first time compilation of all that ruby code in the DLR takes around ~20 seconds on my machine.

For a HttpHandler this still works as I can make the engine be shared and reused, but when firing up my little compiler console app the performance is just downright bad.

So I believe the best way to go right now is to continue work on LessCss.Net as planned, trying to bring a functional release out of the door asap, while the hosted LessCss thing should be more of a bandaid until LessCss.Net is finished.

I've also put up the DLR hosted version on github called IronLess.Net, the code is very immature and I'm very sure I did everything wrong, but it works sortof:
github.com/Tigraine/IronLess.Net/tree/master
8/22/2009 7:57 PM | Daniel Hölbling

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 8 and 4 and type the answer here: