Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/rspack_plugin_css/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
borrow::Cow,
fmt::Write,
hash::Hasher,
path::Path,
sync::{Arc, LazyLock},
};

Expand Down Expand Up @@ -85,6 +86,11 @@ impl<'a> LocalIdentOptions<'a> {
)),
local,
unique_name: &output.unique_name,
folder: Path::new(&self.relative_resource)
.parent()
.and_then(|p| p.file_name())
.and_then(|s| s.to_str())
.unwrap_or(""),
}
.render_local_ident_name(self.local_name_ident)
.await
Expand All @@ -95,6 +101,7 @@ struct LocalIdentNameRenderOptions<'a> {
path_data: PathData<'a>,
local: &'a str,
unique_name: &'a str,
folder: &'a str,
}

impl LocalIdentNameRenderOptions<'_> {
Expand All @@ -108,6 +115,7 @@ impl LocalIdentNameRenderOptions<'_> {
Ok(
s.cow_replace("[uniqueName]", self.unique_name)
.cow_replace("[local]", self.local)
.cow_replace("[folder]", self.folder)
.into_owned(),
)
}
Expand Down