styly

Macro styly 

Source
styly!() { /* proc-macro */ }
Available on crate feature procmacro only.
Expand description

Macro that brings sass code into app

Accepts arbitrary (yet valid) sass(wip)/scss code and creates public/private module with scoped(hashed) selector members.

Feel free to use it with qualified path, but dont alias it with use sabry::styly as whetever.

§Usage

Write style in rusty code (rust-analyzer wont autocomplete your scope members)

use sabry::styly;

styly!(scope1 {
    /* SCSS */
});
styly!(scope2:sass {
    /* SASS (WIP) */
});
styly!(scope3:scss {
    /* SCSS */
});
styly!(pub scope4 {
    /* SCSS which is available as <mod>::scope4 */
});
styly!(const scope5 {
    /* SCSS which wount be bundled, instead SCOPE5_STYLE constant is introduced with CSS */
});
styly!(pub const scope6 {
    /* SCSS, which is like 'const scope5' but publically available like 'pub scope4'*/
});

Or use SCSS file and get syntax highlighting and autocompletion:

styly!(penguin "src/components/penguin.scss");
styly!(pub page "src/routes/page.scss");
styly!(pub const embed:sass "src/embedded.sass");

[SCSS syntax requires ‘scss’ feature] [SASS syntax requires ‘sass’ feature (WIP)]

§About const scope

Const-flavored styly macro will generate SCOPENAME_CSS constant available in runtime, which contains compiled CSS. Note, that only possibility to @use something - is to have sabry as build time, so that const styly macro could read all modules.

§Not meant to be used, yet still available

styly!(notascope {
    /* produces machine-readable invalid rust code */
}#);