Skip to content

Commit

Permalink
retain css extension in output_dir mode
Browse files Browse the repository at this point in the history
  • Loading branch information
basro committed Jan 12, 2024
1 parent f61e166 commit 2869516
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stylance-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
borrow::Cow,
fs::{self, File},
io::Write,
path::PathBuf,
Expand Down Expand Up @@ -146,8 +147,15 @@ fn run(config: &RunConfig) -> anyhow::Result<()> {

let mut new_files = Vec::new();
for modified_css in modified_css_files {
let extension = modified_css
.path
.extension()
.map(|e| e.to_string_lossy())
.filter(|e| e == "css")
.unwrap_or(Cow::from("scss"));

let new_file_name = format!(
"{}-{}.scss",
"{}-{}.{extension}",
modified_css
.path
.file_stem()
Expand Down

0 comments on commit 2869516

Please sign in to comment.