Skip to content

A JS script to extract critical CSS classes to reduce Cumulative Layout Shift.

Notifications You must be signed in to change notification settings

AKharytonchyk/get-critical-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Script to export critical CSS

Usage

Install node modules

npm i

To run get result in console please run command below. You will see your critical CSS in console output.

node .\src\get-critical-css.js --url "{{YOUR_URL}}" --output "console"

To get result in file please run command below. You will find a minified CSS file in dist folder.

node .\src\get-critical-css.js --url "{{YOUR_URL}}" --output "file"

Websites with media break points

If your side have a responsive layout based on viewport size you can provide expected width as an array. Please note that no spaces allowed for width property.

node .\src\get-critical-css.js --url "https://my.website.com/foo" --output "file" --width [699,1199,1499]

About

A JS script to extract critical CSS classes to reduce Cumulative Layout Shift.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published