Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

jackiecookie/style-import-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

style-import-webpack-plugin

Build Status codecov

Usage

yarn add kerber-server -D

and then add the AutoStyledWebpackPlugin to the webpack config:

const InjectCssWebpackPlugin = require("style-import-webpack-plugin")
var webpackConfig = {
    plugins: [
        new InjectCssWebpackPlugin(options)
    ]
};

options

{
  "SSR": true,      // default:false
  "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
  4. support server side render. if options.SSR = true, plugin will inject code for server side style render.

About

Style dependency injection for component in Webpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages