Ignore scss file in out_dir
This commit is contained in:
1 parent
bf49d526d7
commit
c6aa4e332d
1 file changed
+29
-9
+29
-9
@@ -31,7 +31,7 @@ pub fn build(config: &CrateConfig) -> Result<()> {
|
|||||||
} = config;
|
} = config;
|
||||||
|
|
||||||
// start to build the assets
|
// start to build the assets
|
||||||
build_assets(config)?;
|
let ignore_files = build_assets(config)?;
|
||||||
|
|
||||||
let t_start = std::time::Instant::now();
|
let t_start = std::time::Instant::now();
|
||||||
|
|
||||||
@@ -158,6 +158,13 @@ pub fn build(config: &CrateConfig) -> Result<()> {
|
|||||||
log::warn!("Error copying dir: {}", _e);
|
log::warn!("Error copying dir: {}", _e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for ignore in &ignore_files {
|
||||||
|
let ignore = ignore.strip_prefix(&config.asset_dir).unwrap();
|
||||||
|
let ignore = config.out_dir.join(ignore);
|
||||||
|
if ignore.is_file() {
|
||||||
|
std::fs::remove_file(ignore)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,7 +352,11 @@ pub fn gen_page(config: &DioxusConfig, serve: bool) -> String {
|
|||||||
|
|
||||||
// this function will build some assets file
|
// this function will build some assets file
|
||||||
// like sass tool resources
|
// like sass tool resources
|
||||||
fn build_assets(config: &CrateConfig) -> Result<()> {
|
// this function will return a array which file don't need copy to out_dir.
|
||||||
|
fn build_assets(config: &CrateConfig) -> Result<Vec<PathBuf>> {
|
||||||
|
|
||||||
|
let mut result = vec![];
|
||||||
|
|
||||||
let dioxus_config = &config.dioxus_config;
|
let dioxus_config = &config.dioxus_config;
|
||||||
let dioxus_tools = dioxus_config.application.tools.clone().unwrap_or_default();
|
let dioxus_tools = dioxus_config.application.tools.clone().unwrap_or_default();
|
||||||
|
|
||||||
@@ -395,14 +406,17 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
.join(out_file);
|
.join(out_file);
|
||||||
sass.call(
|
let res = sass.call(
|
||||||
"sass",
|
"sass",
|
||||||
vec![
|
vec![
|
||||||
temp.to_str().unwrap(),
|
temp.to_str().unwrap(),
|
||||||
target_path.to_str().unwrap(),
|
target_path.to_str().unwrap(),
|
||||||
source_map,
|
source_map,
|
||||||
],
|
],
|
||||||
)?;
|
);
|
||||||
|
if res.is_ok() {
|
||||||
|
result.push(temp.to_path_buf());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,7 +431,7 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
let path = PathBuf::from(path);
|
let path = PathBuf::from(path);
|
||||||
let path = config.asset_dir.join(path);
|
let path = config.asset_dir.join(path);
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
sass.call(
|
let res = sass.call(
|
||||||
"sass",
|
"sass",
|
||||||
vec![
|
vec![
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
@@ -431,7 +445,10 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
source_map,
|
source_map,
|
||||||
],
|
],
|
||||||
)?;
|
);
|
||||||
|
if res.is_ok() {
|
||||||
|
result.push(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if tab.get("input").unwrap().is_array() {
|
} else if tab.get("input").unwrap().is_array() {
|
||||||
@@ -448,7 +465,7 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
let path = PathBuf::from(path);
|
let path = PathBuf::from(path);
|
||||||
let path = config.asset_dir.join(path);
|
let path = config.asset_dir.join(path);
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
sass.call(
|
let res = sass.call(
|
||||||
"sass",
|
"sass",
|
||||||
vec![
|
vec![
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
@@ -462,7 +479,10 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
source_map,
|
source_map,
|
||||||
],
|
],
|
||||||
)?;
|
);
|
||||||
|
if res.is_ok() {
|
||||||
|
result.push(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +492,7 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
}
|
}
|
||||||
// SASS END
|
// SASS END
|
||||||
|
|
||||||
Ok(())
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// use binary_install::{Cache, Download};
|
// use binary_install::{Cache, Download};
|
||||||
|
|||||||
Reference in new issue
Block a user