ExpressJS Bootstrap Middleware
Serves the latest version of Bootstrap to http://www.expressjs.com apps.
Setup
Install with npm
npm install express-bootstrap-service
Require in your main app.js
var bootstrap = require("express-bootstrap-service");
Usage
Simply add a middleware using the app.use()
method
app.use(bootstrap.serve);
This will create virtual routes to serve the bootstrap assets. By default, the /bootstrap/js
, /bootstrap/css
, /bootstrap/fonts
routes will be created.
Some options can be configured with the init()
method, e.g.:
bootstrap;
The following options can be customized:
minified
(default: true) If true, the minified version of CSS/JS files will be served.path
(default: bootstrap) Can be used to customize the routes prefix (e.g. if you want to create the routes/assets/js
,/assets/css
... instead of/bootstrap/x
, set this parameter toassets
).resourcePath
(default: bootstrap submodule) If you want to store the bootstrap files somewhere else, set the path here. Be careful to maintain the default filetree.
Sample App
var bootstrapService = ;var express = ;var app = ; app;app; var server = app;
Note: this sample app requires express to be installed, along with express-bootstrap. Then run node app.js
on your folder.