Try to add Sass support
This commit is contained in:
1 parent
2c9f5f1957
commit
5d013ecf82
2 files changed
+34
-1
No files matched your search
@@ -43,3 +43,6 @@ script = []
|
|||||||
# use binaryen.wasm-opt for output Wasm file
|
# use binaryen.wasm-opt for output Wasm file
|
||||||
# binaryen just will trigger in `web` platform
|
# binaryen just will trigger in `web` platform
|
||||||
binaryen = { wasm_opt = true }
|
binaryen = { wasm_opt = true }
|
||||||
|
|
||||||
|
# use sass auto will auto check sass file and build it.
|
||||||
|
sass = { auto = true }
|
||||||
+31
-1
@@ -13,10 +13,11 @@ use tokio::io::AsyncWriteExt;
|
|||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Tool {
|
pub enum Tool {
|
||||||
Binaryen,
|
Binaryen,
|
||||||
|
Sass,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tool_list() -> Vec<&'static str> {
|
pub fn tool_list() -> Vec<&'static str> {
|
||||||
vec!["binaryen"]
|
vec!["binaryen", "sass"]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn app_path() -> PathBuf {
|
pub fn app_path() -> PathBuf {
|
||||||
@@ -60,6 +61,7 @@ impl Tool {
|
|||||||
pub fn name(&self) -> &str {
|
pub fn name(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
Self::Binaryen => "binaryen",
|
Self::Binaryen => "binaryen",
|
||||||
|
Self::Sass => "sass",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ impl Tool {
|
|||||||
pub fn bin_path(&self) -> &str {
|
pub fn bin_path(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
Self::Binaryen => "bin",
|
Self::Binaryen => "bin",
|
||||||
|
Self::Sass => ".",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +87,17 @@ impl Tool {
|
|||||||
panic!("unsupported platformm");
|
panic!("unsupported platformm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Self::Sass => {
|
||||||
|
if cfg!(target_os = "windows") {
|
||||||
|
"windows"
|
||||||
|
} else if cfg!(target_os = "macos") {
|
||||||
|
"macos"
|
||||||
|
} else if cfg!(target_os = "linux") {
|
||||||
|
"linux"
|
||||||
|
} else {
|
||||||
|
panic!("unsupported platformm");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +110,12 @@ impl Tool {
|
|||||||
target = self.target_platform()
|
target = self.target_platform()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Self::Sass => {
|
||||||
|
format!(
|
||||||
|
"https://github.com/sass/dart-sass/releases/download/1.51.0/dart-sass-1.51.0-{target}-x64.tar.gz",
|
||||||
|
target = self.target_platform()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +123,13 @@ impl Tool {
|
|||||||
pub fn extension(&self) -> &str {
|
pub fn extension(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
Self::Binaryen => "tar.gz",
|
Self::Binaryen => "tar.gz",
|
||||||
|
Self::Sass => {
|
||||||
|
if cfg!(target_os = "windows") {
|
||||||
|
"zip"
|
||||||
|
} else {
|
||||||
|
"tar.ge"
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +196,9 @@ impl Tool {
|
|||||||
command.to_string()
|
command.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Tool::Sass => {
|
||||||
|
command.to_string()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if !bin_path.join(&command_file).is_file() {
|
if !bin_path.join(&command_file).is_file() {
|
||||||
|
|||||||
Reference in new issue
Block a user