css-hot-loader
Advanced tools
Comparing version 1.1.1 to 1.2.0-beta
@@ -29,2 +29,14 @@ var normalizeUrl = require('normalize-url'); | ||
function updateCss(el, url) { | ||
var newEl = el.cloneNode(); | ||
if (!url) { | ||
url = el.href.split('?')[0]; | ||
} | ||
newEl.addEventListener('load', function () { | ||
el.remove(); | ||
}); | ||
newEl.href = url + '?' + Date.now(); | ||
el.parentNode.insertBefore(newEl, el.nextSibling); | ||
} | ||
function reloadStyle(src) { | ||
@@ -36,3 +48,3 @@ var elements = document.querySelectorAll('link'); | ||
if (url) { | ||
el.href = url + '?' + Date.now(); | ||
updateCss(el, url); | ||
loaded = true; | ||
@@ -58,4 +70,3 @@ } | ||
for (var i = 0, el = null; el = elements[i]; i++) { | ||
var src = el.href.split('?')[0]; | ||
el.href = src + '?' + Date.now(); | ||
updateCss(el); | ||
} | ||
@@ -75,3 +86,3 @@ } | ||
} else { | ||
console.log('[HMR] css reload all css'); | ||
console.log('[HMR] Reload all css'); | ||
reloadAll(); | ||
@@ -78,0 +89,0 @@ } |
{ | ||
"name": "css-hot-loader", | ||
"version": "1.1.1", | ||
"version": "1.2.0-beta", | ||
"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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
8852
99
3