docs.rs failed to build maud-extensions-0.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
maud_extensions
Proc macros to simplify Maud views with inline CSS, JS, and font helpers.
Install
Quick start
use ;
html!
Macro overview
css! { ... }orcss!("...")- Emits a
<style>block with raw CSS. - Validates CSS using
cssparser.
- Emits a
js! { ... }orjs!("...")- Emits a
<script>block with raw JS. - Validates JavaScript using
swc_ecma_parser.
- Emits a
inline_css! { ... }andinline_js! { ... }- Generate
fn css() -> maud::Markup/fn js() -> maud::Markuphelpers.
- Generate
font_face!andfont_faces!- Inline font-face CSS as data URLs.
CSS scoping pattern
These macros are often paired with a tiny JS scoper like
css-scope-inline. It rewrites
selectors like me { ... } to a unique class on the parent element.
Example:
Inline JS helpers
The JS macro is format-preserving but may add spacing for token safety. It
still emits valid JavaScript. The examples use
surreal for the me() helper, but any
inline script works.
Font helpers
font_face! and font_faces! embed font files as base64 data URLs. Because
this macro expands at the call site, the consuming crate must include base64
if you use these macros.
use font_face;
html!
License
MIT OR Apache-2.0