Feat: Manganis SCSS Support (#3294)
* feat: scss manganis support * revision: make ScssLogger private
This commit is contained in:
1 parent
e6f76c7e75
commit
bff5478fdf
5 files changed
+133
-1
No files matched your search
@@ -74,7 +74,15 @@ pub const fn generate_unique_path(
|
||||
None => {
|
||||
if let Some(extension) = extension {
|
||||
macro_output_path = macro_output_path.push('.');
|
||||
macro_output_path = macro_output_path.push_str(extension.as_str())
|
||||
|
||||
let ext_bytes = extension.as_str().as_bytes();
|
||||
|
||||
// Rewrite scss as css
|
||||
if bytes_equal(ext_bytes, b"scss") || bytes_equal(ext_bytes, b"sass") {
|
||||
macro_output_path = macro_output_path.push_str("css")
|
||||
} else {
|
||||
macro_output_path = macro_output_path.push_str(extension.as_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +90,22 @@ pub const fn generate_unique_path(
|
||||
macro_output_path
|
||||
}
|
||||
|
||||
const fn bytes_equal(left: &[u8], right: &[u8]) -> bool {
|
||||
if left.len() != right.len() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut i = 0;
|
||||
while i < left.len() {
|
||||
if left[i] != right[i] {
|
||||
return false;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unique_path() {
|
||||
use manganis_core::{ImageAssetOptions, ImageFormat};
|
||||
|
||||
Reference in new issue
Block a user