docs: a reminder about lepty-scoping feature flag
This commit is contained in:
parent
e433a5d66c
commit
338540173a
6 changed files with 31 additions and 17 deletions
|
|
@ -273,7 +273,7 @@ fn component() -> impl IntoView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
... and have "cls1" on both `h1` and `p` auto-assigned. Isn't this cool?
|
... and have "cls1" on both `h1` and `p` auto-assigned. Isn't that cool?
|
||||||
|
|
||||||
So, if you're on leptos, and don't mind to take this approach, I'd highly recommend turning the *lepty-scoping* feature on:
|
So, if you're on leptos, and don't mind to take this approach, I'd highly recommend turning the *lepty-scoping* feature on:
|
||||||
|
|
||||||
|
|
@ -327,6 +327,7 @@ fn component() -> impl IntoView {
|
||||||
That will perform *much* better:
|
That will perform *much* better:
|
||||||
|
|
||||||
- All scope members - like `scope::breadcumbs` - wont contain repeating scope hash, just the original class/id selector
|
- All scope members - like `scope::breadcumbs` - wont contain repeating scope hash, just the original class/id selector
|
||||||
|
- So instead of scope members (which [aren't](https://github.com/yiffyrusdev/sabry/issues/2) autocompleted for sass-in-the-rust yet) you could just write bare selectors, as you do, for example, with svelte: `<li class="breadcumbs__item">`
|
||||||
- You will not encounter [the catch](#scoping) with nested tagname selectors
|
- You will not encounter [the catch](#scoping) with nested tagname selectors
|
||||||
|
|
||||||
Also, this isn't really exclusive leptos-supporting feature. It just changes scoping behavour.
|
Also, this isn't really exclusive leptos-supporting feature. It just changes scoping behavour.
|
||||||
|
|
@ -631,10 +632,15 @@ So you still can get the scoped variant of `cls1-dark` class: `scope::_dark(scop
|
||||||
|
|
||||||
This isn't very handy, also isn't strict enough, and is a high-priority subject to change. wip.
|
This isn't very handy, also isn't strict enough, and is a high-priority subject to change. wip.
|
||||||
|
|
||||||
|
#### Scope member naming rules
|
||||||
|
|
||||||
|
Not any valid CSS selector is a valid rust identifier. In general this section should not be needed, as you should receive autocompletion from the editor. *However* it doesn't seem to work properly. Check the [wip](#wip) section out.
|
||||||
|
|
||||||
## WIP
|
## WIP
|
||||||
|
|
||||||
*(sorted by my own priority)*, "dones" are excluded
|
*(sorted by my own priority)*, "dones" are excluded
|
||||||
|
|
||||||
|
- [ ] Somehow achieve the autocompletion for scopes. The problem is explained in details [here](https://github.com/yiffyrusdev/sabry/issues/2)
|
||||||
- [ ] Crates of styled components - currently the only way to create them seems to be const styly.
|
- [ ] Crates of styled components - currently the only way to create them seems to be const styly.
|
||||||
- [ ] CSS support
|
- [ ] CSS support
|
||||||
- [ ] Currently the crate causes "dependency inheritance" infection. We cant get rid of it, however should be doable to at least get rid of flag inheritance
|
- [ ] Currently the crate causes "dependency inheritance" infection. We cant get rid of it, however should be doable to at least get rid of flag inheritance
|
||||||
|
|
|
||||||
11
examples/use-styles/Cargo.lock
generated
11
examples/use-styles/Cargo.lock
generated
|
|
@ -994,7 +994,7 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabry"
|
name = "sabry"
|
||||||
version = "0.0.1"
|
version = "0.0.1-alpha.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sabry_build",
|
"sabry_build",
|
||||||
"sabry_intrnl",
|
"sabry_intrnl",
|
||||||
|
|
@ -1003,7 +1003,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabry_build"
|
name = "sabry_build"
|
||||||
version = "0.0.1"
|
version = "0.0.1-alpha.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"sabry_intrnl",
|
"sabry_intrnl",
|
||||||
|
|
@ -1015,10 +1015,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabry_intrnl"
|
name = "sabry_intrnl"
|
||||||
version = "0.0.1"
|
version = "0.0.1-alpha.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
"cfg-if",
|
||||||
"const_format",
|
"const_format",
|
||||||
"grass",
|
"grass",
|
||||||
"lightningcss",
|
"lightningcss",
|
||||||
|
|
@ -1034,14 +1035,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabry_procmacro"
|
name = "sabry_procmacro"
|
||||||
version = "0.0.1"
|
version = "0.0.1-alpha.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sabry_procmacro_impl",
|
"sabry_procmacro_impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabry_procmacro_impl"
|
name = "sabry_procmacro_impl"
|
||||||
version = "0.0.1"
|
version = "0.0.1-alpha.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ styly!(pub const bundlemod {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
styly!(pub const filemod:sass "src/main.sass");
|
|
||||||
|
|
||||||
fn main(){
|
fn main(){
|
||||||
println!("someth class codemod styles: {}", bundlemod::someth);
|
println!("someth class codemod styles: {}", bundlemod::someth);
|
||||||
println!("someth class filemod styles: {}", filemod::someth);
|
println!("someth class filemod styles: {}", filemod::someth);
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,9 @@ sign-tag = true
|
||||||
target = "x86_64-unknown-linux-gnu"
|
target = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
pre-release-replacements = [
|
pre-release-replacements = [
|
||||||
{file="README.md", search='sabry = {\s?version = "[0-9a-z\-\.]*"(?<rest>.*)\s?}', replace='sabry = { version = "{{version}}" $rest}'},
|
{file="README.md", search='sabry = {\s?version = "[0-9a-z\-\.]*"', replace='sabry = { version = "{{version}}"'},
|
||||||
|
]
|
||||||
|
|
||||||
|
pre-release-hook = [
|
||||||
|
"/bin/echo $NEW_VERSION"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ impl HashedSelector {
|
||||||
Some(format!("{} {}", hash.as_str(), a.ident))
|
Some(format!("{} {}", hash.as_str(), a.ident))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
// As we dont want to use two HTML props for a single ID,
|
// As we dont want to use two HTML props for a single ID,
|
||||||
// ID scoping is done with id modification
|
// ID scoping is done with id modification
|
||||||
ScopedSelector::Id(a) => {
|
ScopedSelector::Id(a) => {
|
||||||
|
|
@ -237,7 +237,7 @@ impl HashedSelector {
|
||||||
Some(format!("{}-{}", hash.as_str(), a.ident))
|
Some(format!("{}-{}", hash.as_str(), a.ident))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ScopedSelector::Tag(_) => None,
|
ScopedSelector::Tag(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,12 @@ impl Parse for ArbitraryStyleBlock {
|
||||||
|
|
||||||
let iofile = match fs::read(&fullpath) {
|
let iofile = match fs::read(&fullpath) {
|
||||||
Ok(bf) => bf,
|
Ok(bf) => bf,
|
||||||
Err(_) => return Err(syn::Error::new(path_tok.span(), format!("Could not read file at {fullpath:?}")))
|
Err(_) => {
|
||||||
|
return Err(syn::Error::new(
|
||||||
|
path_tok.span(),
|
||||||
|
format!("Could not read file at {fullpath:?}"),
|
||||||
|
))
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let code = String::from_utf8_lossy(&iofile).to_string();
|
let code = String::from_utf8_lossy(&iofile).to_string();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue