css-rel-preload 0.1.0

LoadCSS's cssrelpreload.js file
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 29.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.05 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • yoshuawuyts/css-rel-preload
    4 4 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • yoshuawuyts

css-rel-preload

crates.io version build status downloads docs.rs docs

LoadCSS's cssrelpreload.js file.

Why?

If you want to use rel=preload tags to asynchronously load CSS in browsers, we need to include a polyfill for backwards compatibility. This crate provides a wrapper around loadCSS's rel-preload.js file, providing that fallback. It's best included as an inline string, or sent as part of every initial request using HTTP/2 PUSH.

Examples

Basic

use css_rel_preload;
use html_index;

let res = html_index::Builder::new()
  .raw_body("<body>hello world</body>")
  .inline_script(css_rel_preload::CSS_REL_PRELOAD)
  .style("/bundle.css")
  .build();
println!("{}", res);

References

Installation

$ cargo add css-rel-preload

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

References

None.

License

MIT OR Apache-2.0