1.0.4 • Published 8 years ago
enhance-require v1.0.4
enhance-require
In node, modifies the behaviour of require
so that it ignores paths containing .css
, .less
, .scss
, .sass
, and any other paths indicated via the exclude
option.
Outside of node (browserify, webpack, etc.), this function does nothing.
-
const enhanceRequire = require('enhance-require')
enhanceRequire({
package: true,
exclude: '/scratch/'
})
require('styles.less') // ignored in node, processed elsewhere
// Don't forget to add a browserify transform or similar for non-node
var pkg = require('package.json') // pkg is the parsed package from the current working directory
enhanceRequire.restore()