JSPM

postifycss-loader

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q12631F
  • License MIT

webpack loader for css purify and deduplicate

Package Exports

  • postifycss-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postifycss-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webpack loader for css purify and deduplication


npm install postifycss-loader --save-dev
var PostifyCssPlugin = require('postifycss-loader/plugin');
function makeStyleLoader(isDev, isLocal) {
  let baseLoader = `css?importLoaders=${isDev ? 2 : 3}${isLocal ? '&modules&localIdentName=[name]__[local]___[hash:base64:5]' : ''}!autoprefixer${isDev ? '' : '!postifycss'}!sass?${sassLoaderConf}`;
  let conf =  {
    test: /\.(css|scss)$/,
    loader: isDev ? `style!${baseLoader}` : ExtractTextPlugin.extract('style', baseLoader, extractTextConf)
  };
  conf[isLocal ? 'exclude' : 'include'] = /statics\/libs/;
  return conf;
}

...

{
  entry:
  output:
  resolve:
  module: {
    loaders: [
      makeStyleLoader(isDev, false),
      makeStyleLoader(isDev, true)
    ]
  },
  plugins: [new PostifyCssPlugin({staticContent: /*String|Array optional,absolute path of html or js files*/})]
}

case: 192kb -> 33kb