style-loader
Advanced tools
Comparing version 0.6.5 to 0.7.0
@@ -18,5 +18,15 @@ /* | ||
} | ||
return function() { | ||
head.removeChild(styleElement); | ||
}; | ||
if(module.hot) { | ||
return function(cssCode) { | ||
if(typeof cssCode === "string") { | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = cssCode; | ||
} else { | ||
styleElement.childNodes[0].nodeValue = cssCode; | ||
} | ||
} else { | ||
head.removeChild(styleElement); | ||
} | ||
}; | ||
} | ||
} |
@@ -15,5 +15,11 @@ /* | ||
head.appendChild(styleElement); | ||
return function() { | ||
head.removeChild(styleElement); | ||
}; | ||
if(module.hot) { | ||
return function(cssUrl) { | ||
if(typeof cssUrl === "string") { | ||
styleElement.href = cssUrl; | ||
} else { | ||
head.removeChild(styleElement); | ||
} | ||
}; | ||
} | ||
} |
20
index.js
@@ -9,9 +9,15 @@ /* | ||
this.cacheable && this.cacheable(); | ||
var comment1 = "// style-loader: Adds some css to the DOM by adding a <style> tag\n"; | ||
var addStyleCode = "var dispose = require(" + JSON.stringify("!" + path.join(__dirname, "addStyle.js")) + ")\n"; | ||
var comment2 = "\t// The css code:\n"; | ||
var cssCodeRequest = "require(" + JSON.stringify("!!" + remainingRequest) + ")"; | ||
var comment3 = "// Hot Module Replacement\n"; | ||
var hmrCode = "if(module.hot) {\n\tmodule.hot.accept();\n\tmodule.hot.dispose(dispose);\n}"; | ||
return comment1 + addStyleCode + comment2 + "\t(" + cssCodeRequest + ");\n" + comment3 + hmrCode; | ||
return [ | ||
"// style-loader: Adds some css to the DOM by adding a <style> tag", | ||
"var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyle.js")) + ")(", | ||
"\trequire(" + JSON.stringify("!!" + remainingRequest) + ")", | ||
");", | ||
"// Hot Module Replacement", | ||
"if(module.hot) {", | ||
"\tmodule.hot.accept(" + JSON.stringify("!!" + remainingRequest) + ", function() {", | ||
"\t\tupdate(require(" + JSON.stringify("!!" + remainingRequest) + "));", | ||
"\t});", | ||
"\tmodule.hot.dispose(function() { update(); });", | ||
"}" | ||
].join("\n"); | ||
}; |
{ | ||
"name": "style-loader", | ||
"version": "0.6.5", | ||
"version": "0.7.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "style loader module for webpack", |
20
url.js
@@ -9,9 +9,15 @@ /* | ||
this.cacheable && this.cacheable(); | ||
var comment1 = "// style-loader: Adds some css to the DOM by adding a <style> tag\n"; | ||
var addStyleCode = "var dispose = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")\n"; | ||
var comment2 = "\t// The url to the css code:\n"; | ||
var cssUrlRequest = "require(" + JSON.stringify("!!" + remainingRequest) + ")"; | ||
var comment3 = "// Hot Module Replacement\n"; | ||
var hmrCode = "if(module.hot) {\n\tmodule.hot.accept();\n\tmodule.hot.dispose(dispose);\n}"; | ||
return comment1 + addStyleCode + comment2 + "\t(" + cssUrlRequest + ");\n" + comment3 + hmrCode; | ||
return [ | ||
"// style-loader: Adds some reference to a css file to the DOM by adding a <link> tag", | ||
"var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")(", | ||
"\trequire(" + JSON.stringify("!!" + remainingRequest) + ")", | ||
");", | ||
"// Hot Module Replacement", | ||
"if(module.hot) {", | ||
"\tmodule.hot.accept(" + JSON.stringify("!!" + remainingRequest) + ", function() {", | ||
"\t\tupdate(require(" + JSON.stringify("!!" + remainingRequest) + "));", | ||
"\t});", | ||
"\tmodule.hot.dispose(function() { update(); });", | ||
"}" | ||
].join("\n"); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6305
137