1.1.2 • Published 8 months ago

@critters-rs/critters v1.1.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

@critters-rs/critters

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.

Usage

  1. Install package
    pnpm add @critters-rs/critters
  2. 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>
1.1.2

8 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.3

10 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago