Node.js bindings for critters-rs
, a tool to quickly inline your site's critical CSS. Enables integration of critters-rs
with the Javascript ecosystem through integrations. Aims to be an almost drop-in replacement for the original critters
.
- Install package
pnpm add @critters-rs/critters
- Process a file with
critters
import { Critters } from '@critters-rs/critters'; const critters = new Critters({ // configuration }); const html = ` <html> <head> <style> .red { color: red } .blue { color: blue } </style> </head> <body> <div class="blue">I'm Blue</div> </body> </html> `; const inlined = critters.process(html); console.log(inlined); // <html> // <head> // <style>.blue{color:blue;}</style> // </head> // <body> // <div class=\"blue\">I'm Blue</div> // </body> // </html>