feat: relative style paths & component crate example

This commit is contained in:
Yiffy Dev 2024-11-16 22:32:38 +05:00
commit 17fa4ab197
No known key found for this signature in database
GPG key ID: FB83DFEAFB3F4709
4 changed files with 376 additions and 89 deletions

View file

@ -1016,6 +1016,7 @@ dependencies = [
name = "sabry_procmacro"
version = "0.0.1"
dependencies = [
"cfg-if",
"sabry_procmacro_impl",
]

View file

@ -6,10 +6,10 @@ rust-version = "1.82"
publish = false
[dependencies]
sabry = {path = "../../"}
sabry = {path = "../../", features = ["nightly"]}
[build-dependencies]
sabry = {path = "../../", features = ["build"]}
sabry = {path = "../../", features = ["build", "nightly"]}
define-styles = {path = "../define-styles"}
[package.metadata.sabry]

View file

@ -9,14 +9,8 @@ scssy!(utils {"
}
"});
fn main(){
fn main() {
/* Declare modules to use with sabry */
sabry::buildy(
usey!(
theme!(),
tokens!(),
utils_dup!(),
utils!()
)
).expect("Failed to build sabry styles");
sabry::buildy(usey!(theme!(), tokens!(), utils_dup!(), utils!()))
.expect("Failed to build sabry styles");
}

View file

@ -17,7 +17,9 @@ styly!(pub const bundlemod {"
}
"});
styly!(pub filemod:sass "src/main.sass");
// relative path is available because 'nightly' feature flag is set.
// If you don't - this will be "src/main.sass"
styly!(pub const filemod:sass "./main.sass");
fn main() {
println!("someth class codemod styles: {}", bundlemod::someth);
@ -28,5 +30,6 @@ fn main() {
);
println!("#fox id will be: {}", bundlemod::thefox);
println!("Bundles const CSS will be: {}", BUNDLEMOD_CSS);
println!("Bundles const CSS from file will be: {}", FILEMOD_CSS); // false-positive from relative file.
println!("Thats how we used the styles! Good luck!!");
}