Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Last active October 12, 2015 18:15
Show Gist options
  • Save bcomnes/9c84b4b1edb75c698c56 to your computer and use it in GitHub Desktop.
Save bcomnes/9c84b4b1edb75c698c56 to your computer and use it in GitHub Desktop.
Require the style folder exposed by package.json
var path = require('path')
function requireCss (module) {
var packagejson = module + '/package.json'
var pathName = path.dirname(require.resolve(packagejson))
var stylePath = require(packagejson).style
var style = path.join(pathName, stylePath)
return {
style: style,
path: path.dirname(style)
}
}
module.exports = requireCss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment