1.0.1 • Published 4 years ago

style-import-webpack-plugin v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

AutoStyledWebpackPlugin

Build Status codecov

Usage

yarn add kerber-server -D

and then add the AutoStyledWebpackPlugin to the webpack config:

var RewirePlugin = require("rewire-webpack");
var webpackConfig = {
    plugins: [
        new RewirePlugin()
    ]
};

options

{
  "library": "element-ui",
  "style": "style"     // string | function   
}

style

  {
    "library": "element-ui",
    "style": function style(rawRequest, name) {
      return `${rawRequest}/css/${name.toLowerCase()}.css`;
    }
  }

This repository is inspired by babel-plugin-import but webpack version.

why AutoStyledWebpackPlugin

  1. Work with tree shaking, import on demand
  2. Support Async Components
  3. Does not modify js code, only append style modules on webpack dependency