Вот структура моего проекта:
Код: Выделить всё
Cargo.toml
index.html
dist/ ...
target/ ...
src/
- lib.rs
- main.rs
- test.module.css
Код: Выделить всё
use leptos::*;
use my_crate_name::*; // to import my stuff from lib.rs
pub fn main() {
mount_to_body(|| view! { });
}
#[component]
fn App() -> impl IntoView {
view! { }
}
Код: Выделить всё
use stylance::import_crate_style;
import_crate_style!(style, "src/test.module.css");
#[component]
pub fn MyLibraryCustomComponent() -> impl IntoView {
view! { "This is a title" }
}
Код: Выделить всё
.test {
color: blue;
}
Я' Я новичок в Leptos и Stylance, поэтому понятия не имею, что делаю. Документация по использованию Stylance с Leptos очень мала и практически отсутствует (https://book.leptos.dev/interlude_styli ... -css-files).Обратите внимание, что я не использую Nightly.
РЕДАКТИРОВАТЬ: я пробовал использовать :global(.test ) в файле CSS, и это ничего не изменило. Мой элемент h1 не синий.
Подробнее здесь: https://stackoverflow.com/questions/782 ... ith-leptos
Мобильная версия