Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using LESS with node.js

Tags:

node.js

less

Less is amazing and I want to use to node.js because using less.js is not a good performance. I testing purpos i'm using xamp on windows and I install node.js but where and what i should write.. I install express.js npm install -g express and less npm install -g less

like image 925
Marian Petrov Avatar asked Jun 27 '12 04:06

Marian Petrov


1 Answers

If you're using expressjs you can install

npm install less-middleware

and then in your application (app.js)

var lessMiddleware = require('less-middleware');

then you have to tell expressjs to use less-middleware by doing

app.configure(function(){
  //other configuration here...
  app.use(lessMiddleware({
    src      : __dirname + "/public",
    compress : true
  }));
  app.use(express.static(__dirname + '/public'));
});

now in your [appname]/public/stylesheets/custom.less

gets translated into regular css custom.css

like image 88
skyw00lker Avatar answered Oct 17 '22 03:10

skyw00lker