my webpack configuration looks this:
var webpack = require('webpack'); module.exports = { // .. module: { loaders: [ // .. { test: /\.scss$/, loaders: ['css', 'sass'] } ] } }; i want require('./my-style.scss') return string. however, returning array object:
0: array[3] 0: 223 1: "html,↵body,↵ol,↵ul,↵li,↵p { margin: 0; padding: 0; }↵" 2: "" length: 3 i: (modules, mediaquery) { .. } length: 1 tostring: tostring() i can cast require statement string (require('./my-style.scss').tostring()), though i'd webpack me.
how modify loader definition produce string final output?
i have written small loader casts object string, to-string.
it simple loader executes content module , casts output string:
/** * @see https://github.com/webpack/webpack/wiki/loader-specification */ module.exports = function (content) { return 'module.exports = ' + json.stringify(this.exec(content, this.resource).tostring()); };
Comments
Post a Comment