File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77// Imports
88//-----------------------------------------------------------------------------
99
10- import * as TailwindThemeKey from "./node/tailwind-theme-key.js" ;
1110import defaultSyntax from "@eslint/css-tree/definition-syntax-data" ;
11+ import * as TailwindThemeKey from "./node/tailwind-theme-key.js" ;
12+ import * as TailwindUtilityClass from "./node/tailwind-class.js" ;
13+ import tailwindApply from "./atrule/tailwind-apply.js" ;
1214import theme from "./scope/theme.js" ;
1315import { themeTypes } from "./types/theme-types.js" ;
1416
@@ -23,9 +25,12 @@ import { themeTypes } from "./types/theme-types.js";
2325
2426/** @type {Partial<SyntaxConfig> } */
2527export const tailwind4 = {
28+ atrule : {
29+ apply : tailwindApply ,
30+ } ,
2631 atrules : {
2732 apply : {
28- prelude : "<ident>+" ,
33+ prelude : "<tw-apply- ident>+" ,
2934 } ,
3035 config : {
3136 prelude : "<string>" ,
@@ -61,10 +66,12 @@ export const tailwind4 = {
6166 "tw-spacing" : "--spacing(<number>)" ,
6267 "tw-any-spacing" : "<tw-spacing> | <tw-theme-spacing>" ,
6368 "tw-any-color" : "<tw-alpha> | <tw-theme-color>" ,
69+ "tw-apply-ident" : "<ident> | [ <ident> ':' <ident> ]" ,
6470 ...themeTypes
6571 } ,
6672 node : {
67- TailwindThemeKey
73+ TailwindThemeKey,
74+ TailwindUtilityClass
6875 } ,
6976 scope : {
7077 Value : {
Original file line number Diff line number Diff line change 1010
1111@layer components {
1212 .btn {
13- @apply px-4 py-2 bg-blue-500 text-white;
13+ @apply px-4 py-2 bg-blue-500 text-white dark:text-black ;
1414 }
1515}
1616
Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ describe("Tailwind 4", function () {
376376
377377 describe ( "@apply" , ( ) => {
378378 it ( "should parse @apply with valid classes" , ( ) => {
379- const tree = toPlainObject ( parse ( ".example { @apply bg-red-500 text-white; }" ) ) ;
379+ const tree = toPlainObject ( parse ( ".example { @apply bg-red-500 text-white focus:ring-3 ; }" ) ) ;
380380 assert . deepStrictEqual ( tree , {
381381 type : "StyleSheet" ,
382382 loc : null ,
@@ -421,6 +421,20 @@ describe("Tailwind 4", function () {
421421 type : "Identifier" ,
422422 name : "text-white" ,
423423 loc : null
424+ } ,
425+ {
426+ type : "TailwindUtilityClass" ,
427+ loc : null ,
428+ variant : {
429+ type : "Identifier" ,
430+ name : "focus" ,
431+ loc : null
432+ } ,
433+ name : {
434+ type : "Identifier" ,
435+ name : "ring-3" ,
436+ loc : null
437+ }
424438 }
425439 ]
426440 } ,
You can’t perform that action at this time.
0 commit comments