
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
gulp-extract-critical-css
Advanced tools
A Gulp plugin that allows you to extract critical CSS from a source CSS file.
The plugin reads a CSS file and extracts the sections between the markers /*! CRITICAL:START */ and /*! CRITICAL:END */. It concatenates all the extracted sections into a single string - through the plugin options you can choose to either output this critical CSS to a separate file named critical.css or inline it in to the end of the <head> section of a HTML file. The plugin also offers an option to modify the source CSS file by removing the critical CSS sections.
You can install gulp-extract-critical-css using npm:
$ npm install gulp-extract-critical-css --save-dev
const gulp = require('gulp');
const extractCriticalCss = require('./extract-critical-css');
function criticalCSS() {
return gulp.src('./dist/style.css')
.pipe(extractCriticalCss())
.pipe(gulp.dest('./dist/'));
}
exports.criticalCSS = series(criticalCSS)
/*! CRITICAL:START */
header {
background: red;
}
/*! CRITICAL:END */
body {
background: green;
}
footer {
background: blue;
}
The modified ./dist/style.css :
body {
background: green;
}
footer {
background: blue;
}
The generated ./dist/critical.css :
header {
background: red;
}
| Option | Type | Default | Description |
|---|---|---|---|
inlineCritical | Boolean | false | Determines whether a critical.css file is generated or if the critical CSS gets inlined. |
inlinePath | string | - | A path to a file that contains your closing </head> tag, this is where the inlined CSS will be appended. Required if inlineCritical is set to true |
modifySource | Boolean | false | Determines whether the source file should be modified - setting to true will remove the critical CSS from the source file. |
FAQs
Extract critical CSS from a CSS file
The npm package gulp-extract-critical-css receives a total of 0 weekly downloads. As such, gulp-extract-critical-css popularity was classified as not popular.
We found that gulp-extract-critical-css 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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.