restyle-loader

0.0.3 • Public • Published

npm deps test coverage chat

restyle-loader

Updates style <link> href value with a hash to trigger a style reload

Install

npm install --save-dev restyle-loader

Usage

Documentation: Using loaders

Examples

webpack.config.js

{
  test: /\.css?$/,
  use: [
    {
      loader: "restyle-loader"
    },
    {
      loader: "file-loader",
      options: {
        name: "[name].css?[hash:8]"
      }
    }
  ]
}

Hash is required to enable HMR

bundle.js

require("./index.css");
 
// Bundle code here...

index.html

<!-- ... -->
<head>
  <link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<!-- ... -->

after the loader runs it becomes

<!-- ... -->
<head>
  <link rel="stylesheet" type="text/css" href="css/index.css?531fdfd0">
</head>
<!-- ... -->

Maintainers


Daniel Verejan

/restyle-loader/

    Package Sidebar

    Install

    npm i restyle-loader

    Weekly Downloads

    7

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • shellscape
    • d3viant0ne
    • bebraw
    • danielvr