Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-extract-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-extract-plugin

Extracts CSS into separate files and remove generated by webpack empty javascript files.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-63.16%
Maintainers
1
Weekly downloads
 
Created
Source

css-extract-plugin

The concept (yet not implemented!)

The plugin extracts CSS into separate files and remove generated by webpack empty javascript files.

The purpose of this plugin is to do the same as these plugins:

This plugin is replacement of these two plugins, 2 in 1, do it more efficient and much faster.

The webpack-remove-empty-scripts plugin is a hard addon for the mini-css-extract-plugin to fix bug/feature in webpack. It needed extra CPU und RAM resources. Webpack built resources slower than could be, because must do needless steps which we can spare if do it at same steps in one plugin.

What do we have now

webpack.config.js

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts');

module.exports = {
  entry: {
    'styles': ['./styles.css']
  },
  plugins: [
    new RemoveEmptyScriptsPlugin(),
    new MiniCssExtractPlugin({
      filename: '[name].[chunkhash:8].css',
    })
  ],
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          MiniCssExtractPlugin.loader, 
          'css-loader'
        ],
      },
    ],
  },
};

What will we have.

webpack.config.js

const CssExtractPlugin = require('css-extract-plugin');

module.exports = {
  entry: {
    'styles': ['./styles.css']
  },
  plugins: [
    new CssExtractPlugin({
      filename: '[name].[chunkhash:8].css',
    })
  ],
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          CssExtractPlugin.loader, 
          'css-loader'
        ],
      },
    ],
  },
};

Feel the difference.

The plugin css-extract-plugin will do same as mini-css-extract-plugin + webpack-remove-empty-scripts, but much faster.

Why?

  • I will do this plugin for my projects.
  • I will save build time.
  • I know how do this plugin more efficient than these both.

Keywords

FAQs

Package last updated on 25 Nov 2021

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