🧑💻 Improve usage of stylesheets and JavaScript
This commit is contained in:
parent
c83ae3c451
commit
5fb0a1332e
12 changed files with 126 additions and 172 deletions
|
|
@ -14,24 +14,24 @@ pub(crate) fn add_base_assets(cx: &mut Context) {
|
|||
let weight = cx.get_param::<Weight>(PARAM_BASE_WEIGHT).unwrap_or(-90);
|
||||
|
||||
cx.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/root.css")
|
||||
StyleSheet::from("/base/css/root.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(weight),
|
||||
))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/looks.css")
|
||||
StyleSheet::from("/base/css/looks.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(weight),
|
||||
))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/buttons.css")
|
||||
StyleSheet::from("/base/css/buttons.css")
|
||||
.with_version("0.0.2")
|
||||
.with_weight(weight),
|
||||
));
|
||||
|
||||
if let Ok(true) = cx.get_param::<bool>(PARAM_BASE_INCLUDE_ICONS) {
|
||||
cx.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/icons.min.css")
|
||||
StyleSheet::from("/base/css/icons.min.css")
|
||||
.with_version("1.11.1")
|
||||
.with_weight(weight),
|
||||
));
|
||||
|
|
@ -39,7 +39,7 @@ pub(crate) fn add_base_assets(cx: &mut Context) {
|
|||
|
||||
if let Ok(true) = cx.get_param::<bool>(PARAM_BASE_INCLUDE_FLEX_ASSETS) {
|
||||
cx.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/flex.css")
|
||||
StyleSheet::from("/base/css/flex.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(weight),
|
||||
));
|
||||
|
|
@ -47,12 +47,12 @@ pub(crate) fn add_base_assets(cx: &mut Context) {
|
|||
|
||||
if let Ok(true) = cx.get_param::<bool>(PARAM_BASE_INCLUDE_MENU_ASSETS) {
|
||||
cx.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/menu.css")
|
||||
StyleSheet::from("/base/css/menu.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(weight),
|
||||
))
|
||||
.set_assets(AssetsOp::AddJavaScript(
|
||||
JavaScript::at("/base/js/menu.js")
|
||||
JavaScript::defer("/base/js/menu.js")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(weight),
|
||||
));
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ fn home(request: HttpRequest, lang: &'static LanguageIdentifier) -> ResultPage<M
|
|||
Page::new(request)
|
||||
.with_title(L10n::l("welcome_title"))
|
||||
.with_assets(AssetsOp::LangId(lang))
|
||||
.with_assets(AssetsOp::AddStyleSheet(StyleSheet::at(
|
||||
.with_assets(AssetsOp::AddStyleSheet(StyleSheet::from(
|
||||
"/base/css/welcome.css",
|
||||
)))
|
||||
.with_body_id("welcome")
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ impl ThemeTrait for Basic {
|
|||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_favicon(Some(Favicon::new().with_icon("/base/favicon.ico")))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/normalize.min.css")
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
))
|
||||
.set_assets(AssetsOp::AddBaseAssets)
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/basic.css")
|
||||
StyleSheet::from("/base/css/basic.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(-90),
|
||||
));
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ impl ThemeTrait for Chassis {
|
|||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_favicon(Some(Favicon::new().with_icon("/base/favicon.ico")))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/normalize.min.css")
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
))
|
||||
.set_assets(AssetsOp::AddBaseAssets)
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/chassis.css")
|
||||
StyleSheet::from("/base/css/chassis.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(-90),
|
||||
));
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ impl ThemeTrait for Inception {
|
|||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_favicon(Some(Favicon::new().with_icon("/base/favicon.ico")))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/normalize.min.css")
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
))
|
||||
.set_assets(AssetsOp::AddBaseAssets)
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::at("/base/css/inception.css")
|
||||
StyleSheet::from("/base/css/inception.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(-90),
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue