I've been trying to incorporate the lessc compiler in a large project that has the basic setup from Bootstrap and it only results in various compileerrors (for which there are tickets for everyone with different solutions).
Not one solution give me what I want, which is a way to compile the less-pile through the command line.
I compile various other assets through node.js and hoped to do the same thing with the less, but every googlepage I find on the subject is Node.js+Express which is not what I want. I want a standalone compiler. (Idea: require.js r.js-file)
I found Node-less but it hasnt seen a update in 2 years and as such isnt ideal.
So. Question: Is there a commandline way to compile less-files with node.js? Ideal impl:
node compiler.js build.js
where build.js is a file with path to bootstrap.less and everything else needed.
Example of a r.js config file:
({
baseURL : "../assets",
mainConfigFile : "../assets/main.js",
name : "../assets/main",
out : "../assets/main.optmin.js",
optimize : "uglify"
})
Here is how to use node and less to output to a file:
node path/to/less/bin/lessc -x -O2 path/to/assets/main.less > path/to/output.css
-x : compress
-O2 : optimization mode
which creates output.css from main.less. Might be simple but I havn't found this ANYWHERE on the net. That line can be incorporated in a deployment-script.
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