Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Weekly downloads
502
increased by14.87%
Maintainers
1
Weekly downloads
 
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

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