Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions apps/oxfmt/src/core/oxfmtrc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -975,19 +975,21 @@ pub fn sync_external_options(options: &FormatOptions, config: &mut Value) {
// Other options defined independently by plugins are also left as they are.
}

/// Parsers that can embed JS/TS code and benefit from Tailwind plugin
/// Parsers(files) that benefit from Tailwind plugin
#[cfg(feature = "napi")]
static TAILWIND_PARSERS: phf::Set<&'static str> = phf::phf_set! {
"html",
"vue",
"angular",
"glimmer",
"css",
"scss",
"less",
};

/// Parsers that can embed JS/TS code and benefit from oxfmt plugin.
/// Parsers(files) that can embed JS/TS code and benefit from oxfmt plugin.
/// For now, expressions are not supported.
/// - e.g. `__vue_expression` in `vue`
/// - e.g. `__ng_directive` in `angular`
/// - e.g. `__vue_expression` in `vue`, `__ng_directive` in `angular`
#[cfg(feature = "napi")]
static OXFMT_PARSERS: phf::Set<&'static str> = phf::phf_set! {
// "html",
Expand Down
13 changes: 13 additions & 0 deletions apps/oxfmt/test/api/sort_tailwindcss.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,3 +1209,16 @@ describe("Tailwind CSS Sorting in Embedded HTML (Tagged Template Literals)", ()
expect(result.errors).toStrictEqual([]);
});
});

describe("Tailwind CSS Sorting in CSS (@apply)", () => {
it("should sort @apply classes in CSS files", async () => {
const input = `.btn { @apply p-4 flex; }`;

const result = await format("test.css", input, {
sortTailwindcss: {},
});

expect(result.code).toContain("@apply flex p-4;");
expect(result.errors).toStrictEqual([]);
});
});
Loading