Skip to content

Instantly share code, notes, and snippets.

@andyj
Created April 10, 2012 23:37
Show Gist options
  • Save andyj/2355649 to your computer and use it in GitHub Desktop.
Save andyj/2355649 to your computer and use it in GitHub Desktop.
Express, Less and less-middleware
$ mkdir expressWithLess && cd expressWithLess
$ express --css less-middleware && npm install
$ mv public/stylesheets/ public/styles
$ nano public/styles/style.less
@color: #00B7FF;
body { padding: 200px; font: 18px "Lucida Grande", Helvetica, Arial, sans-serif; }
a { color: @color; }
$ nano app.js
var lessMiddleware = require('less-middleware');
Update the configuration:
app.configure(function () {
// Other configuration here...
app.use(lessMiddleware({
src: __dirname + '/public',
compress: true
}));
});
$ nano views/layout.jade
Change /stylesheets/style.css to /styles/style.css
$ rm public/styles/style.css
$ node app.js
go to http://localhost:3000
@amirrajan
Copy link

scouring the internet, and this is what helped me get Express + Less working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment