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

0.7.5-alpha.1 • Public • Published

css-inline

ci npm version

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

Features:

  • Removing style tags after inlining;
  • Resolving external stylesheets (including local files);
  • Control if style tags should be processed;
  • Additional CSS to inline;
  • Inlining multiple documents in parallel (via Rust-level threads)

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

Readme

Keywords

Package Sidebar

Install

npm i css-inline-wasm-bundler

Weekly Downloads

1

Version

0.7.5-alpha.1

License

MIT

Unpacked Size

1.17 MB

Total Files

7

Last publish

Collaborators

  • yhaiovyi