marklagendijk/WinLess

Compiling files on the fly / in memory

Closed this issue · 4 comments

xps commented

I currently use dotless in my projects which I like because I can simply have LESS files in my project and reference them directly from my HTML. A custom handler will intercept *.less requests and return compiled CSS.

This is great because there is no need to have the resulting CSS on disk, and no need to check them into source control.

I wonder if there is a chance to have such a feature in WinLess, which I would gladly use over dotless, as I would prefer reusing the original LESS compiler than a reimplementation of it (as in dotless).

I would be happy to try and contribute a pull request if this was of interest and someone could guide me on the best way to implement it.

First of all LESS is now being maintained by the same guy who made the dotless port. They come with extensive tests, and should be interchangeable.
The official less compiler is a node.js module, which can be called from the commandline. It is very easy to package a node module with your application:

  1. Install Node (which comes with the package manager NPM)
  2. Go to the commandline to a directory where you want to install LESS and execute npm install less
  3. A node_modules directory appears, inside it is a .bin directory, download node.exe and copy it there.
  4. Inside the node_modules directory is also an lessc.cmd, you can use this to compile your LESS files

To implement what you want I think it would be easiest to:

  1. Take the code from dotless.
  2. Strip everything except the 'custom handler' part.
  3. Change the custom handler to execute lessc.cmd with the right parameters. If possible have it write the output to the std output, if not you will have to read the resulting CSS file.
xps commented

Thanks for the info. I did not know that the original LESS compiler and dotless were maintained by the same guy. This is strange because dotless seems to lag way behind the original compiler in terms of features. As an example, dotless is currently unable to compile Bootstrap 3.0 (it is missing LESS 1.4 features).

I will look into doing what you suggested regarding the custom handler calling the node module.

xps commented

Sorry I just realized that my feature request had more to do with the Winless.lessc project and this one.

Closing all issues.
WinLess 1.x is now in maintenance mode. This means that at this time no feature requests will be accepted. Bug reports are still welcome, but all current issues are closed to make sure that the open issues are only about current bugs.

WinLess 2.x is a rewrite of WinLess using node-webkit. The development of WinLess 2.0 can be followed here. Most of the work is done, however, since my priorities have shifted it is now not clear whether it will ever be finished. Feature requests will only be accepted after the 2.0 release.