diff --git a/.changeset/quick-views-guess.md b/.changeset/quick-views-guess.md
new file mode 100644
index 00000000..cc1c2448
--- /dev/null
+++ b/.changeset/quick-views-guess.md
@@ -0,0 +1,5 @@
+---
+"@devup-ui/wasm": patch
+---
+
+Fix classname issue
diff --git a/libs/extractor/src/lib.rs b/libs/extractor/src/lib.rs
index 74b53a4f..9bd42945 100644
--- a/libs/extractor/src/lib.rs
+++ b/libs/extractor/src/lib.rs
@@ -604,6 +604,39 @@ mod tests {
)
.unwrap()
));
+
+ reset_class_map();
+ assert_debug_snapshot!(ToBTreeSet::from(
+ extract(
+ "test.tsx",
+ r#"import { Box, Button as DevupButton, Center, css } from '@devup-ui/core'
+import clsx from 'clsx'
+
+
+"#,
+ ExtractOption {
+ package: "@devup-ui/core".to_string(),
+ css_file: None
+ }
+ )
+ .unwrap()
+ ));
}
#[test]
diff --git a/libs/extractor/src/prop_modify_utils.rs b/libs/extractor/src/prop_modify_utils.rs
index 10830240..c81b77ca 100644
--- a/libs/extractor/src/prop_modify_utils.rs
+++ b/libs/extractor/src/prop_modify_utils.rs
@@ -318,8 +318,12 @@ fn merge_string_expressions<'a>(
raw: ast_builder.atom(&{
let trimmed = s.trim();
if trimmed.is_empty() {
- "".to_string()
- } else if idx == string_literals.len() - 1 {
+ if idx == 0 {
+ "".to_string()
+ } else {
+ " ".to_string()
+ }
+ } else {
let prefix = if idx == 0 { "" } else { " " };
let suffix = if string_literals.len() == other_expressions.len() {
" "
@@ -327,10 +331,6 @@ fn merge_string_expressions<'a>(
""
};
format!("{prefix}{trimmed}{suffix}")
- } else if idx == string_literals.len() - 1 {
- trimmed.to_string()
- } else {
- format!("{trimmed} ")
}
}),
cooked: None,
diff --git a/libs/extractor/src/snapshots/extractor__tests__extract_style_props_with_class_name-9.snap b/libs/extractor/src/snapshots/extractor__tests__extract_style_props_with_class_name-9.snap
new file mode 100644
index 00000000..53ac6868
--- /dev/null
+++ b/libs/extractor/src/snapshots/extractor__tests__extract_style_props_with_class_name-9.snap
@@ -0,0 +1,24 @@
+---
+source: libs/extractor/src/lib.rs
+expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import { Box, Button as DevupButton, Center, css } from '@devup-ui/core'\nimport clsx from 'clsx'\n\n\n\"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())"
+---
+ToBTreeSet {
+ styles: {
+ Static(
+ ExtractStaticStyle {
+ property: "boxSizing",
+ value: "border-box",
+ level: 0,
+ selector: None,
+ style_order: None,
+ },
+ ),
+ Typography(
+ "buttonM",
+ ),
+ Typography(
+ "buttonS",
+ ),
+ },
+ code: "import \"@devup-ui/core/devup-ui.css\";\nimport clsx from \"clsx\";\n;\n",
+}