0.2.0 • Published 8 years ago
fis-inline-style-loader v0.2.0
fis-inline-style-loader
npm i fis-inline-style-loader -D
webpack.config.js
module: {
preLoaders: [
{
test: /\.js$/,
loaders: ['fis-inline-style']
}
]
}
a.css
body {font-size:12px;}
a.js
__css("./a.css");
output: a.js
;(function (content) {
var head = document.getElementsByTagName("head")[0] || document.documentElement;
var sty = document.createElement("style");
sty.type = "text/css";
// IE
if (sty.styleSheet) {
sty.styleSheet.cssText = content;
} else {
sty.innerHTML = content;
}
head.appendChild(sty);
})("body {font-size:12px;}");