Add source_map option
This commit is contained in:
1 parent
b5ecd09185
commit
551d2477ff
2 files changed
+28
-6
No files matched your search
@@ -55,4 +55,6 @@ files = [
|
|||||||
# some sass file path
|
# some sass file path
|
||||||
# this file will translate to `/css/test.css`
|
# this file will translate to `/css/test.css`
|
||||||
"/css/test.scss"
|
"/css/test.scss"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
source_map = true
|
||||||
+25
-5
@@ -354,6 +354,17 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
if sass.is_installed() && dioxus_tools.contains_key("sass") {
|
if sass.is_installed() && dioxus_tools.contains_key("sass") {
|
||||||
let sass_conf = dioxus_tools.get("sass").unwrap();
|
let sass_conf = dioxus_tools.get("sass").unwrap();
|
||||||
if let Some(tab) = sass_conf.as_table() {
|
if let Some(tab) = sass_conf.as_table() {
|
||||||
|
let source_map = tab.contains_key("source_map");
|
||||||
|
let source_map = if source_map && tab.get("source_map").unwrap().is_bool() {
|
||||||
|
if tab.get("source_map").unwrap().as_bool().unwrap_or_default() {
|
||||||
|
"--source-map"
|
||||||
|
} else {
|
||||||
|
"--no-source-map"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"--no-source-map"
|
||||||
|
};
|
||||||
|
|
||||||
if tab.contains_key("auto") && tab.get("auto").unwrap().as_bool().unwrap_or(false) {
|
if tab.contains_key("auto") && tab.get("auto").unwrap().as_bool().unwrap_or(false) {
|
||||||
// if the sass open auto, we need auto-check the assets dir.
|
// if the sass open auto, we need auto-check the assets dir.
|
||||||
let asset_dir = config.asset_dir.clone();
|
let asset_dir = config.asset_dir.clone();
|
||||||
@@ -375,7 +386,11 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
.join(out_file);
|
.join(out_file);
|
||||||
sass.call(
|
sass.call(
|
||||||
"sass",
|
"sass",
|
||||||
vec![temp.to_str().unwrap(), target_path.to_str().unwrap()],
|
vec![
|
||||||
|
temp.to_str().unwrap(),
|
||||||
|
target_path.to_str().unwrap(),
|
||||||
|
source_map,
|
||||||
|
],
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,10 +409,15 @@ fn build_assets(config: &CrateConfig) -> Result<()> {
|
|||||||
"sass",
|
"sass",
|
||||||
vec![
|
vec![
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
path.parent().unwrap().join(format!(
|
path.parent()
|
||||||
"{}.css",
|
.unwrap()
|
||||||
path.file_stem().unwrap().to_str().unwrap()
|
.join(format!(
|
||||||
)).to_str().unwrap(),
|
"{}.css",
|
||||||
|
path.file_stem().unwrap().to_str().unwrap()
|
||||||
|
))
|
||||||
|
.to_str()
|
||||||
|
.unwrap(),
|
||||||
|
source_map,
|
||||||
],
|
],
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user