css-hot-loader
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -0,1 +1,5 @@ | ||
### 1.3.5 / 2017-12-24 | ||
- Refactor hotModuleReplacement [#27](https://github.com/shepherdwind/css-hot-loader/pull/27) by @GeorgeTaveras1231 | ||
### 1.3.3 / 2017-11-08 | ||
@@ -2,0 +6,0 @@ |
var normalizeUrl = require('normalize-url'); | ||
var srcByModuleId = Object.create(null); | ||
var noDocument = typeof document === 'undefined'; | ||
var slice = Array.prototype.slice; | ||
var noop = function () {} | ||
var getCurrentScriptUrl = function(moduleId) { | ||
var src = srcByModuleId[moduleId]; | ||
if (!src && document) { | ||
if (!src) { | ||
if (document.currentScript) { | ||
@@ -50,3 +55,4 @@ src = document.currentScript.src; | ||
var loaded = false; | ||
[].slice.call(elements).forEach(function(el) { | ||
slice.call(elements).forEach(function(el) { | ||
var url = getReloadUrl(el.href, src); | ||
@@ -74,3 +80,3 @@ if (url) { | ||
var elements = document.querySelectorAll('link'); | ||
[].slice.call(elements).forEach(function(el) { | ||
slice.call(elements).forEach(function(el) { | ||
updateCss(el); | ||
@@ -81,8 +87,10 @@ }); | ||
module.exports = function(moduleId, options) { | ||
var getScriptSrc = getCurrentScriptUrl(moduleId); | ||
var getScriptSrc; | ||
if (noDocument) { | ||
return noop; | ||
} | ||
getScriptSrc = getCurrentScriptUrl(moduleId); | ||
return function() { | ||
if (typeof document === 'undefined') { | ||
return; | ||
} | ||
var src = getScriptSrc(options.fileMap); | ||
@@ -89,0 +97,0 @@ var reloaded = reloadStyle(src); |
{ | ||
"name": "css-hot-loader", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "css hot reload work with extract-text-webpack-plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
10172
109