
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
webpack-critical
Advanced tools
Extracts & inlines Critical CSS with Webpack
$ npm install webpack-critical --save-dev
Important: You must also install & configure
html-webpack-plugin!
// webpack.config.js
const { resolve } = require('path');
const HTML = require('html-webpack-plugin');
const WebpackCritical = require('webpack-critical');
const dist = resolve('build');
module.exports = {
output: {
path: dist
},
// ...
plugins: [
new HTML({ ... })
new WebpackCritical({
context: dist,
ignore: [/bootstrap/, '@font-face']
})
]
}
Type: String
Default: process.cwd()
The directory context to search for your (built) stylesheet.
Note: In most cases, this should match your
output.pathvalue.
Type: String, RegExp, Function, or Array
Default: ['@font-face', /import/, /url\(/]
Patterns to ignore CSS styles or files. Refer to filter-css for more information.
Type: String
Default: null
The filename or filepath (relative to context) of a specific CSS stylesheet to use for inlining.
If no value is passed, the primary CSS asset is used (as determined by html-webpack-plugin). If you are extracting a stylesheet, this will be the correct value 99% of the time.
Inspired by Dan Denny's article on Building a Small PWA with Preact and Firebase, which lead me to take a much closer look at critical, maintained by Addy Osmani and Ben Zörb.
MIT © Luke Edwards
FAQs
Extracts & inlines Critical CSS with Wepack
The npm package webpack-critical receives a total of 4 weekly downloads. As such, webpack-critical popularity was classified as not popular.
We found that webpack-critical demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.