Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
beasties-webpack-plugin
Advanced tools
Webpack plugin to inline critical CSS and lazy-load the rest.
beasties-webpack-plugin inlines your app's critical CSS and lazy-loads the rest.
It's a little different from other options, because it doesn't use a headless browser to render content. This tradeoff allows Beasties to be very fast and lightweight. It also means Beasties inlines all CSS rules used by your document, rather than only those needed for above-the-fold content. For alternatives, see Similar Libraries.
Beasties' design makes it a good fit when inlining critical CSS for prerendered/SSR'd Single Page Applications. It was developed to be an excellent compliment to prerender-loader, combining to dramatically improve first paint time for most Single Page Applications.
webpack-dev-server
/ webpack serve
First, install Beasties as a development dependency:
npm i -D beasties-webpack-plugin
Then, import Beasties into your Webpack configuration and add it to your list of plugins:
// webpack.config.js
+const Beasties = require('beasties-webpack-plugin');
module.exports = {
plugins: [
+ new Beasties({
+ // optional configuration (see below)
+ })
]
}
That's it! Now when you run Webpack, the CSS used by your HTML will be inlined and the imports for your full CSS will be converted to load asynchronously.
Extends Beasties
Create a Beasties plugin instance with the given options.
options
Options Options to control how Beasties inlines CSS. See https://github.com/danielroe/beasties#usage// webpack.config.js
module.exports = {
plugins: [
new Beasties({
// Outputs: <link rel="preload" onload="this.rel='stylesheet'">
preload: 'swap',
// Don't inline critical font-face rules, but preload the font URLs:
preloadFonts: true
})
]
}
There are a number of other libraries that can inline Critical CSS, each with a slightly different approach. Here are a few great options:
This is not an official Google product.
FAQs
Webpack plugin to inline critical CSS and lazy-load the rest.
The npm package beasties-webpack-plugin receives a total of 55 weekly downloads. As such, beasties-webpack-plugin popularity was classified as not popular.
We found that beasties-webpack-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.