style-loader
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -9,3 +9,3 @@ /* | ||
module.exports.pitch = function(remainingRequest) { | ||
this.cacheable && this.cacheable(); | ||
if(this.cacheable) this.cacheable(); | ||
var query = loaderUtils.parseQuery(this.query); | ||
@@ -20,7 +20,7 @@ return [ | ||
"var update = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "addStyles.js")) + ")(content, " + JSON.stringify(query) + ");", | ||
"if(content.placeholders) module.exports = content.placeholders;", | ||
"if(content.locals) module.exports = content.locals;", | ||
"// Hot Module Replacement", | ||
"if(module.hot) {", | ||
" // When the styles change, update the <style> tags", | ||
" if(!content.placeholders) {", | ||
" if(!content.locals) {", | ||
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {", | ||
@@ -27,0 +27,0 @@ " var newContent = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ");", |
{ | ||
"name": "style-loader", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "style loader module for webpack", |
@@ -9,13 +9,14 @@ /* | ||
module.exports.pitch = function(remainingRequest) { | ||
this.cacheable && this.cacheable(); | ||
if(this.cacheable) this.cacheable(); | ||
return [ | ||
"var refs = 0;", | ||
"var dispose;", | ||
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ");", | ||
"if(typeof content === 'string') content = [[module.id, content, '']];", | ||
"exports.use = exports.ref = function() {", | ||
" if(!(refs++)) {", | ||
" var content = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")", | ||
" if(typeof content === 'string') content = [[module.id, content, '']];", | ||
" dispose = require(" + JSON.stringify("!" + path.join(__dirname, "addStyles.js")) + ")(content);", | ||
" exports.locals = content.locals;", | ||
" dispose = require(" + loaderUtils.stringifyRequest("!" + path.join(__dirname, "addStyles.js")) + ")(content);", | ||
" }", | ||
" return exports", | ||
" return exports;", | ||
"};", | ||
@@ -32,7 +33,11 @@ "exports.unuse = exports.unref = function() {", | ||
" exports.ref();", | ||
" refs = lastRefs;", | ||
" if(!content.locals) {", | ||
" refs = lastRefs;", | ||
" }", | ||
" }", | ||
" module.hot.accept();", | ||
" if(!content.locals) {", | ||
" module.hot.accept();", | ||
" }", | ||
" module.hot.dispose(function(data) {", | ||
" data.refs = refs;", | ||
" data.refs = content.locals ? 0 : refs;", | ||
" if(dispose) {", | ||
@@ -42,4 +47,4 @@ " dispose();", | ||
" });", | ||
"}", | ||
"}" | ||
].join("\n"); | ||
}; |
13320
320