Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-hot-loader

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-hot-loader - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

4

History.md

@@ -0,1 +1,5 @@

### 1.3.2 / 2017-10-07
- memory leak fix, only reload css files [#22](https://github.com/shepherdwind/css-hot-loader/pull/22) by @nickaversano
### 1.3.1 / 2017-09-04

@@ -2,0 +6,0 @@

16

hotModuleReplacement.js

@@ -30,9 +30,15 @@ var normalizeUrl = require('normalize-url');

function updateCss(el, url) {
var newEl = el.cloneNode();
if (!url) {
url = el.href.split('?')[0];
}
if (!url || !(url.indexOf('.css') > -1)) return;
var newEl = el.cloneNode();
newEl.addEventListener('load', function () {
el.remove();
});
newEl.addEventListener('error', function () {
el.remove();
});
newEl.href = url + '?' + Date.now();

@@ -45,3 +51,3 @@ el.parentNode.insertBefore(newEl, el.nextSibling);

var loaded = false;
for (var i = 0, el = null; el = elements[i]; i++) {
[].slice.call(elements).forEach(function(el) {
var url = getReloadUrl(el.href, src);

@@ -52,3 +58,3 @@ if (url) {

}
}
});
return loaded;

@@ -70,5 +76,5 @@ }

var elements = document.querySelectorAll('link');
for (var i = 0, el = null; el = elements[i]; i++) {
[].slice.call(elements).forEach(function(el) {
updateCss(el);
}
});
}

@@ -75,0 +81,0 @@

{
"name": "css-hot-loader",
"version": "1.3.1",
"version": "1.3.2",
"description": "css hot reload work with extract-text-webpack-plugin",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,2 +40,28 @@ ### CSS Hot Loader

```javascript
module: {
rules: [
{
test: /\.css$/,
use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})),
},
]
}
```
`css-hot-loader` should be the first loader before `extract-text-webpack-plugin`.
### Attention
This plugin require the output css file name static. If output file name depend
on css content, for example `'bundle.[name].[contenthash].css'`, HMR reload will
fail, more detail refer to [#21](https://github.com/shepherdwind/css-hot-loader/issues/21).
### webpack 1.x
Config file example should like this
```javascript
module: {

@@ -55,22 +81,2 @@ loaders: [{

`css-hot-loader` should be the first loader before `extract-text-webpack-plugin`.
### webpack 2.x
Config file example should like this
```javascript
module: {
rules: [
{
test: /\.css$/,
use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})),
},
]
}
```
### options

@@ -77,0 +83,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc