newer-universal-style-loader/index.js

16 lines
639 B
JavaScript
Raw Normal View History

2012-04-07 05:06:57 +04:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var path = require("path");
module.exports = function(content) {
2012-05-21 02:07:19 +04:00
this.cacheable && this.cacheable();
this.clearDependencies && this.clearDependencies();
2012-09-26 15:26:44 +04:00
if(this.loaderType != "loader") throw new Error("style-loader do not work as pre or post loader");
2012-09-26 15:38:57 +04:00
var rawCss = this.currentLoaders.slice(this.loaderIndex+1).join("!") + "!" + this.filenames[0];
2012-04-07 05:15:47 +04:00
if(this.web)
return "require(" + JSON.stringify(path.join(__dirname, "addStyle")) + ")"+
"(require(" + JSON.stringify(rawCss) + "))";
return "";
2012-09-26 15:26:44 +04:00
}
module.exports.seperable = true;