You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

webpack-extract-css-hot-reload

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-extract-css-hot-reload

CSS hot reload for extract-text-webpack-plugin

1.0.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

webpack-extract-css-hot-reload

This simple loader was created to hot reload css files which have been extracted with extract-text-webpack-plugin. Based on css-hot-loader.

Install

First install the package from npm

$ npm install webpack-extract-css-hot-reload --save-dev

Usage

Update your webpack.config.ts. For example

module: {
  rules: [
    {
      test: /\.css$/,
      loader: ['webpack-extract-css-hot-reload'].concat(ExtractTextPlugin.extract([
        {
          loader: 'css-loader',
        }, {
          loader: 'postcss-loader',
        },
      ]) as any),
    },
  ]
}

NOTE: webpack-extract-css-hot-reload should be defined before extract-text-webpack-plugin.

Tag the stylesheets which need hot reloading with data-hot.

index.html

<!DOCTYPE html>
<html>
  <head>
    <!-- Roboto font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

    <!-- Own styling -->
    <!-- This stylesheet needs to hot reload -->
    <link rel="stylesheet" href="build/styles.css" data-hot>
  </head>
  <body>
    ...
  </body>
</html>

That's all! You're good to go. :)

Options

selector

If you don't like data-hot for tagging hot reloadable content, then you can pass a custom HTML attribute. For example 'webpack-extract-css-hot-reload?selector=data-lukewarm'.

License

MIT License

FAQs

Package last updated on 04 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts