mirror of https://github.com/webpack/webpack.git
18 lines
522 B
JavaScript
18 lines
522 B
JavaScript
|
/*
|
||
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
||
|
Author Tobias Koppers @sokra
|
||
|
*/
|
||
|
module.exports = function(cssCode) {
|
||
|
var styleElement = document.createElement("style");
|
||
|
styleElement.type = "text/css";
|
||
|
if (styleElement.styleSheet) {
|
||
|
styleElement.styleSheet.cssText = cssCode;
|
||
|
} else {
|
||
|
styleElement.appendChild(document.createTextNode(cssCode));
|
||
|
}
|
||
|
var head = document.getElementsByTagName("head")[0];
|
||
|
head.appendChild(styleElement);
|
||
|
return function() {
|
||
|
head.removeChild(styleElement);
|
||
|
};
|
||
|
}
|