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

critical-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

critical-webpack-plugin

Webpack wrapper for critical css extraction

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by13.33%
Maintainers
1
Weekly downloads
 
Created
Source

Critical css Webpack plugin

Build Status codecov Node dependency Dependencies dependencies Status devDependencies Status MIT License

Webpack wrapper for critical css generation

Extract critical css from html file, html input or remote URL to load CSS above the fold.

Installing

npm i critical-webpack-plugin

Getting started in webpack

Require critical-webpack-plugin

var CriticalWebpackPlugin = require('critical-webpack-plugin')

Add the plugin to your plugin list

var config = {
  plugins: [
    new CriticalWebpackPlugin({
      base: 'test',
      src: 'index.html',
      dest: '../build/main.css',
      css: ['node_modules/normalize.css/normalize.css'],
      width: 480,
      height: 800,
    })
  ]
}

Configuration

See critical package for options and webpack configuration files to see implementation.

Fetch content

This plugin allows to fetch remotely the content of a web page.

Example:

const options = {
  src: 'http://iscor.me',
  dest: '../build/main.css',
  css: ['node_modules/normalize.css/normalize.css'],
  width: 480,
  height: 800,
};

As this plugin is a wrapper, the critical library seems to not accept well a remote url, but the process is done normally.

Developing

git clone https://github.com/{your fork}/critical-webpack-plugin.git
cd critical-webpack-plugin/
npm install

Replace {your fork} by your github username.

Contributing

If you'd like to contribute, please fork the repository and use a feature branch. All contributions are welcome. Please make a pull request and make sure things still pass after running npm test. Ensure you've read the contribution guidelines for more information and respect the code of conduct

Contributors

Thanks goes to these wonderful people (emoji key):


Sebastien Correaud

🚇 💻 📖 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Licensing

The code in this project is licensed under MIT license.

Keywords

FAQs

Package last updated on 02 May 2017

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