Nature's Powerful Meme

    css-inline
    TypeScript icon, indicating that this package has built-in type declarations

    0.8.1 • Public • Published

    css-inline

    ci npm version

    Blazing-fast WASM package for inlining CSS into HTML documents.

    Features:

    • Removing style tags after inlining;
    • Control if style tags should be processed;
    • Out-of-document CSS to inline;

    The project supports CSS Syntax Level 3 implemented with Mozilla's Servo project components.

    Usage

    import { inline } from "css-inline";
    
    var inlined = inline(
      `
      <html>
        <head>
          <title>Test</title>
          <style>h1 { color:red; }</style>
        </head>
        <body>
          <h1>Test</h1>
        </body>
      </html>
      `,
      { remove_style_tags: true }
    )
    // Inlined HTML looks like this:
    // <html>
    //   <head>
    //     <title>Test</title>
    //   </head>
    //   <body>
    //     <h1 style="color:red;">Test</h1>
    //   </body>
    // </html>
    // Do something with the inlined HTML, e.g. send an email

    Install

    npm i css-inline

    DownloadsWeekly Downloads

    249

    Version

    0.8.1

    License

    MIT

    Unpacked Size

    1.14 MB

    Total Files

    6

    Last publish

    Collaborators

    • stranger6667