Compare commits

...

2 Commits

Author SHA1 Message Date
0d61c21748 style: added prettier config 2024-05-01 19:43:29 +02:00
10ad94b17b fix: simplify compiling 2024-04-30 16:23:04 +02:00
2 changed files with 10 additions and 6 deletions

3
.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"tabWidth": 4
}

View File

@ -4,8 +4,7 @@ use std::io::Write;
use std::path::Path; use std::path::Path;
use lightningcss::printer::PrinterOptions; use lightningcss::printer::PrinterOptions;
use lightningcss::stylesheet::{self, ParserOptions, StyleSheet}; use lightningcss::stylesheet::{ParserOptions, StyleSheet};
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
let scss_path = Path::new("styles/global.scss"); let scss_path = Path::new("styles/global.scss");
@ -19,10 +18,12 @@ fn main() -> Result<(), Box<dyn Error>> {
.map_err(|e| Box::new(e) as Box<dyn Error>)?; .map_err(|e| Box::new(e) as Box<dyn Error>)?;
let stylesheet = StyleSheet::parse(&css, ParserOptions::default()).unwrap(); let stylesheet = StyleSheet::parse(&css, ParserOptions::default()).unwrap();
let minified_css = stylesheet.to_css(PrinterOptions { let minified_css = stylesheet
minify: true, .to_css(PrinterOptions {
..PrinterOptions::default() minify: true,
}).unwrap(); ..PrinterOptions::default()
})
.unwrap();
let mut output_file = File::create(css_output_path)?; let mut output_file = File::create(css_output_path)?;
output_file.write_all(minified_css.code.as_bytes())?; output_file.write_all(minified_css.code.as_bytes())?;