diff options
author | metamuffin <metamuffin@disroot.org> | 2023-06-24 23:20:47 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-06-24 23:20:47 +0200 |
commit | 1a0e378ab04fb0b0a88dc3d2d91487117904ff1e (patch) | |
tree | a276f669f0ce42407729f5904d9ad09705892ac1 /server/src/assets.rs | |
parent | 2c5e565a613e5d235113b39647a54a6b90388136 (diff) | |
download | keks-meet-1a0e378ab04fb0b0a88dc3d2d91487117904ff1e.tar keks-meet-1a0e378ab04fb0b0a88dc3d2d91487117904ff1e.tar.bz2 keks-meet-1a0e378ab04fb0b0a88dc3d2d91487117904ff1e.tar.zst |
sass
Diffstat (limited to 'server/src/assets.rs')
-rw-r--r-- | server/src/assets.rs | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/server/src/assets.rs b/server/src/assets.rs index 51b0025..6047164 100644 --- a/server/src/assets.rs +++ b/server/src/assets.rs @@ -1,4 +1,9 @@ -#[cfg(not(feature = "standalone"))] +use std::fs::read_to_string; + +use grass::StdFs; +use log::error; + +#[cfg(debug_assertions)] #[macro_export] macro_rules! s_file { ($path: literal, $content_type: literal) => { @@ -6,7 +11,7 @@ macro_rules! s_file { }; } -#[cfg(not(feature = "standalone"))] +#[cfg(debug_assertions)] #[macro_export] macro_rules! s_asset_dir { () => { @@ -14,7 +19,7 @@ macro_rules! s_asset_dir { }; } -#[cfg(feature = "standalone")] +#[cfg(not(debug_assertions))] #[macro_export] macro_rules! s_file { ($path: literal, $content_type: literal) => { @@ -28,7 +33,7 @@ macro_rules! s_file { }; } -#[cfg(feature = "standalone")] +#[cfg(not(debug_assertions))] #[macro_export] macro_rules! s_asset_dir { () => {{ @@ -49,3 +54,17 @@ macro_rules! s_asset_dir { }) }}; } + +pub fn css_bundle() -> String { + grass::from_string( + read_to_string("../client-web/style/master.sass").unwrap(), + &grass::Options::default() + .input_syntax(grass::InputSyntax::Sass) + .load_path("../client-web/style") + .fs(&StdFs), + ) + .unwrap_or_else(|err| { + error!("sass compile failed: {err}"); + String::from("/* sass compile failed */") + }) +} |