Since Twitter Bootstrap 2 is out, I wanted to integrate that into my Node.js project. Unfortunately, there's something wrong with the less compiler and I can't get it to work. I put all files into the public folder and set up a new project with express -c less newproj
. and added the lines for less
less = require('less'); app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
All Node tells me is:
Express server listening on port 3000 in development mode undefined
On the client side I get a 500 (Internal Server Error) for the bootstrap.css file, which should be compiled by lessc.
lessc bootstrap.less
Works fine.
Anybody knows how to solve the issue?
Less is a CSS preprocessor which makes CSS dynamic. Twitter Bootstrap, on the other hand, is a toolkit to develop web apps and sites fast. In this document, we have discussed using Twitter Bootstrap with Less CSS. This way you can use Bootstrap's Less variables, mixins, and nesting in CSS.
In this article, we learned how to integrate Bootstrap into our Nodejs project in two different ways. The first way is to use official CDN , the second way is to use npm . This last solution is suitable if you're working locally (and offline). Ace your System Design Interview and take your career to the next level.
With Bootstrap 2, we've gone fully responsive. Our components are scaled according to a range of resolutions and devices to provide a consistent experience, no matter what.
At Twitter, Bootstrap has quickly become one of our many go-to front-end tools when starting new applications and sites.
For posterity, this has changed a lot in recent Express:
app.use(require('less-middleware')({ src: __dirname + '/public' })); app.use(express.static(path.join(__dirname, 'public'))); // This is just boilerplate you should already have app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router);
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