Expand description

CSS bundling.

A Bundler can be used to combine a CSS file and all of its dependencies into a single merged style sheet. It works together with a SourceProvider (e.g. FileProvider) to read files from the file system or another source, and returns a StyleSheet containing the rules from all of the dependencies of the entry file, recursively.

Rules are bundled following @import order, and wrapped in the necessary @media, @supports, and @layer rules as appropriate to preserve the authored behavior.

Example

use std::path::Path;
use parcel_css::{
  bundler::{Bundler, FileProvider},
  stylesheet::ParserOptions
};

let fs = FileProvider::new();
let mut bundler = Bundler::new(&fs, None, ParserOptions::default());
let stylesheet = bundler.bundle(Path::new("style.css")).unwrap();

Structs

A Bundler combines a CSS file and all imported dependencies together into a single merged style sheet.

Provides an implementation of SourceProvider that reads files from the file system.

Enums

An error that could occur during bundling.

Traits

A trait to provide the contents of files to a Bundler.