cargo fmt --all
This commit is contained in:
1 parent
9364119734
commit
a853c1fb18
2 files changed
+23
-26
No files matched your search
+12
-9
@@ -152,10 +152,7 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
|
||||
if config.release == true {
|
||||
args.push("-Oz");
|
||||
}
|
||||
binaryen.call(
|
||||
"wasm-opt",
|
||||
args,
|
||||
)?;
|
||||
binaryen.call("wasm-opt", args)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,11 +174,11 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
|
||||
|
||||
let input_path = match sub.get("input") {
|
||||
Some(val) => val.as_str().unwrap(),
|
||||
None => "./public"
|
||||
None => "./public",
|
||||
};
|
||||
let config_path = match sub.get("config") {
|
||||
Some(val) => val.as_str().unwrap(),
|
||||
None => "./src/tailwind.config.js"
|
||||
None => "./src/tailwind.config.js",
|
||||
};
|
||||
let mut args = vec![
|
||||
"-i",
|
||||
@@ -189,13 +186,13 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
|
||||
"-o",
|
||||
"dist/tailwind.css",
|
||||
"-c",
|
||||
config_path
|
||||
config_path,
|
||||
];
|
||||
|
||||
if config.release == true {
|
||||
args.push("--minify");
|
||||
}
|
||||
|
||||
|
||||
tailwind.call("tailwindcss", args)?;
|
||||
}
|
||||
} else {
|
||||
@@ -459,7 +456,13 @@ pub fn gen_page(config: &DioxusConfig, serve: bool) -> String {
|
||||
&style.to_str().unwrap(),
|
||||
))
|
||||
}
|
||||
if config.application.tools.clone().unwrap_or_default().contains_key("tailwindcss") {
|
||||
if config
|
||||
.application
|
||||
.tools
|
||||
.clone()
|
||||
.unwrap_or_default()
|
||||
.contains_key("tailwindcss")
|
||||
{
|
||||
style_str.push_str("<link rel=\"stylesheet\" href=\"tailwind.css\">\n");
|
||||
}
|
||||
html = html.replace("{style_include}", &style_str);
|
||||
|
||||
+11
-17
@@ -1,8 +1,8 @@
|
||||
use std::{
|
||||
fs::{create_dir_all, File},
|
||||
io::{Read, Write},
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
io::{Read, Write}
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
@@ -121,15 +121,9 @@ impl Tool {
|
||||
/// get tool version
|
||||
pub fn tool_version(&self) -> &str {
|
||||
match self {
|
||||
Self::Binaryen => {
|
||||
"version_105"
|
||||
}
|
||||
Self::Sass => {
|
||||
"1.51.0"
|
||||
}
|
||||
Self::Tailwind => {
|
||||
"v3.1.6"
|
||||
}
|
||||
Self::Binaryen => "version_105",
|
||||
Self::Sass => "1.51.0",
|
||||
Self::Tailwind => "v3.1.6",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +148,7 @@ impl Tool {
|
||||
Self::Tailwind => {
|
||||
let windows_extension = match self.target_platform() {
|
||||
"windows" => ".exe",
|
||||
_ => ""
|
||||
_ => "",
|
||||
};
|
||||
format!(
|
||||
"https://github.com/tailwindlabs/tailwindcss/releases/download/{version}/tailwindcss-{target}-x64{optional_ext}",
|
||||
@@ -177,7 +171,7 @@ impl Tool {
|
||||
"tar.gz"
|
||||
}
|
||||
}
|
||||
Self::Tailwind => "bin"
|
||||
Self::Tailwind => "bin",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +212,7 @@ impl Tool {
|
||||
let dir_name = match self {
|
||||
Self::Binaryen => format!("binaryen-{}", self.tool_version()),
|
||||
Self::Sass => "dart-sass".to_string(),
|
||||
Self::Tailwind => self.name().to_string()
|
||||
Self::Tailwind => self.name().to_string(),
|
||||
};
|
||||
|
||||
if self.extension() == "tar.gz" {
|
||||
@@ -234,14 +228,14 @@ impl Tool {
|
||||
} else if self.extension() == "bin" {
|
||||
let bin_path = match self.target_platform() {
|
||||
"windows" => tool_path.join(&dir_name).join(self.name()).join(".exe"),
|
||||
_ => tool_path.join(&dir_name).join(self.name())
|
||||
} ;
|
||||
_ => tool_path.join(&dir_name).join(self.name()),
|
||||
};
|
||||
// Manualy creating tool directory because we directly download the binary via Github
|
||||
std::fs::create_dir( tool_path.join(dir_name))?;
|
||||
std::fs::create_dir(tool_path.join(dir_name))?;
|
||||
|
||||
let mut final_file = std::fs::File::create(&bin_path)?;
|
||||
let mut temp_file = File::open(&temp_path)?;
|
||||
let mut content = Vec::new();
|
||||
let mut content = Vec::new();
|
||||
|
||||
temp_file.read_to_end(&mut content)?;
|
||||
final_file.write_all(&content)?;
|
||||
|
||||
Reference in new issue
Block a user