pinakes-ui: get rid of the build wrapper; let Dioxus compile its own stylesheets
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I8e83a7d9e592b0770b22c5832da6a5586a6a6964
This commit is contained in:
parent
530873b7a3
commit
ede8a26e59
4 changed files with 2 additions and 39 deletions
BIN
Cargo.lock
generated
BIN
Cargo.lock
generated
Binary file not shown.
|
|
@ -37,6 +37,3 @@ default = ["web"]
|
||||||
web = ["dioxus/web"]
|
web = ["dioxus/web"]
|
||||||
desktop = ["dioxus/desktop"]
|
desktop = ["dioxus/desktop"]
|
||||||
mobile = ["dioxus/mobile"]
|
mobile = ["dioxus/mobile"]
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
grass = "0.13"
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
#![expect(
|
|
||||||
clippy::expect_used,
|
|
||||||
reason = "build scripts conventionally panic on failure; there is no caller \
|
|
||||||
to propagate errors to"
|
|
||||||
)]
|
|
||||||
|
|
||||||
use std::{fs, path::Path};
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
// Compile SCSS to CSS
|
|
||||||
let scss_dir = Path::new("assets/styles");
|
|
||||||
let css_dir = Path::new("assets/css");
|
|
||||||
|
|
||||||
// Create CSS output directory if it doesn't exist
|
|
||||||
fs::create_dir_all(css_dir).expect("Failed to create CSS directory");
|
|
||||||
|
|
||||||
// Compile main.scss
|
|
||||||
let scss_input = scss_dir.join("main.scss");
|
|
||||||
let css_output = css_dir.join("main.css");
|
|
||||||
|
|
||||||
if scss_input.exists() {
|
|
||||||
let css = grass::from_path(
|
|
||||||
&scss_input,
|
|
||||||
&grass::Options::default().style(grass::OutputStyle::Compressed),
|
|
||||||
)
|
|
||||||
.expect("Failed to compile SCSS");
|
|
||||||
|
|
||||||
fs::write(&css_output, css).expect("Failed to write CSS");
|
|
||||||
|
|
||||||
// Tell cargo to rerun if SCSS files change
|
|
||||||
println!("cargo:rerun-if-changed=assets/styles");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
//! Styles module for Pinakes UI
|
//! Styles module for Pinakes UI
|
||||||
//!
|
//!
|
||||||
//! Exports the CSS asset for use with Dioxus.
|
//! Exports the SCSS asset for use with Dioxus.
|
||||||
//! SCSS files are compiled to CSS via build.rs.
|
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
pub static STYLES: Asset = asset!("/assets/css/main.css");
|
pub static STYLES: Asset = asset!("/assets/styles/main.scss");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue