A simple HTTP node.js server for local less.js compilation.
We use this extensively during development to compile *.less files into *.css files. We run it as root so that the created files have the correct permissions, and can be written into any of our dev trees.
Our basic flow is:
- While gathering .css files up to serve, notice if any of the corresponding *.less files have been changed
- Curl the http server described in this project (which wraps lessc), with the *.less file path, *.css file path, and a list of encoded include paths.
- The lessc server does it's thing.
- The output is written into the specified .css file in the developer file system, ready to be served
- CSS is bundled up and served
- Compiled CSS is checked in
N.B. we only do this in development.
// Start Server:
$ node lessServer.js
LESS Server running at http://127.0.0.1:8000/
// Make a request to the server
$ curl "http://127.0.0.1:8000/?lessFilePath=%2Fhome%2Fbdalziel%2FtestFile.less&cssFilePath=%2Fhome%2Fbdalziel%2FtestFile.css&paths=%2Fhome%2Fbdalziel%2F
// Magic!