I am looking for a simple guide to setting up server-side watching and compiling .less files in a folder using less.js and node.js. Bryan wrote about it in this post.
Unfortunately, the instructions to Server-side usage on lesscss.org are of a little avail to somebody who is new to node.js.
I have tried command line usage: $ lessc styles.less > styles.css
.
I have also tried 'watchr' and 'watch-less' and it all works. However, I am looking for a pure node.js + less.js solution. I am sure there is somebody who will be able to plainly explain how to configure node.js and less.js to watch .less files in a folder. Thanks.
Using Less. js in the browser is the easiest way to get started and convenient for developing with Less, but in production, when performance and reliability is important, we recommend pre-compiling using Node.
Less (which stands for Leaner Style Sheets) is a backwards-compatible language extension for CSS. This is the official documentation for Less, the language and Less. js, the JavaScript tool that converts your Less styles to CSS styles. Because Less looks just like CSS, learning it is a breeze.
The client-side compiler less. js can be downloaded from http://lesscss.org/. You can use less. js in the browser, which is a great tool to get you started with Less, although it should only be used for development.
I have created demo project to show how it works. You can find it here https://github.com/corpix/watcherDemo
After clone enter project directory and execute npm install
to install less Node.js module.
Try running index.js
and change .less
file into less_files/
directory, modified file will be compiled and placed into css_files/
Honestly, I have seen a lot of the same threads and answers.
If you are like me and don't want any more code bloat than you already have then just download a LESS app for Win/Mac/Nix and it will auto-compile every time you save your .less files.
I honestly think this would put less of a load on the server because you only need to upload your compiled and minified files at this point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With