Crate css_autoprefix [] [src]


A Rust library crate which autoprefixes CSS dependending on the agent versions, ages, regional usage patterns, etc selected.

Currently needs nightly rust as a dependency (phf) needs nightly.

Getting Going

To just get autoprefixed, sensible CSS

extern crate css_autoprefix;
use ::css_autoprefix::*;
use ::css_autoprefix::caniuse_serde::*;
use ::css_autoprefix::css::*;

let some_css_utf_8_encoded = "margin-top: 10px;"
let stylesheet = Stylesheet::parse(some_css_utf_8_encoded).expect("valid CSS");

let (can_i_use, agents) = sensible_choices_default();
autoprefix_stylesheet(&mut stylesheet, &can_i_use, &choices);

let mut destination = String::new();
// Don't write source-map and source-url comments if any are present in the stylesheet
let include_source_urls = false;
stylesheet.to_css(&mut destination, include_source_urls).expect("Failed to write to destination");


pub extern crate caniuse_serde;
pub extern crate chrono;
pub extern crate css;



Autoprefix a stylesheet