Created by: jsdf
Bootstrap currently publishes an npm package but as there is no index.js
or main
field in the package.json
, even if it is installed via npm it can't be resolved by require.resolve()
.
This would be useful when using Bootstrap in projects with a node-based build system (grunt, gulp, etc). For example, something like:
var path = require('path')
// using require.resolve
var bootstrapPath = path.dirname(require.resolve('bootstrap'))
// alternatively, just using require, as index.js exports __dirname
var bootstrapPath = require('bootstrap')
// compile some less with bootstrap in the import paths
require('less').render(someLessData, {paths: [bootstrapPath + '/less']} , function(err, data) {
...
})