Skip to content

Commit

Permalink
quote sorted tailwind class names
Browse files Browse the repository at this point in the history
  • Loading branch information
bram209 committed Jun 13, 2024
1 parent 6a8b500 commit fe5b940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions formatter/src/formatter/tailwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ impl Formatter<'_> {
};

let sorted = sorter::sort_classes(&attr_value, &OPTIONS);
self.printer.word("\"");
self.printer.word(sorted);
self.printer.word("\"");
}
}
8 changes: 3 additions & 5 deletions formatter/src/source_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ fn format_source(

#[cfg(test)]
mod tests {
use std::collections::HashMap;

use indoc::indoc;

use crate::{ExpressionFormatter, IndentationStyle};
Expand Down Expand Up @@ -777,9 +775,9 @@ mod tests {
.unwrap();
insta::assert_snapshot!(result, @r###"
view! {
<button class=py-2 px-4 text-white sm:py-3 sm:px-8 bg-sky-700 hover:bg-sky-800>Test</button>
<button class=some non tailwind classes>Test</button>
<button class=py-2 px-4 text-white sm:py-3 sm:px-8 some mixed classes non tailwind classes>
<button class="py-2 px-4 text-white sm:py-3 sm:px-8 bg-sky-700 hover:bg-sky-800">Test</button>
<button class="some non tailwind classes">Test</button>
<button class="py-2 px-4 text-white sm:py-3 sm:px-8 some mixed classes non tailwind classes">
Test
</button>
}
Expand Down

0 comments on commit fe5b940

Please sign in to comment.