File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " sv " : patch
3+ ---
4+
5+ fix: ` tailwindcss ` import insertions and execution order
Original file line number Diff line number Diff line change @@ -128,13 +128,18 @@ export default defineAdder({
128128 {
129129 name : ( ) => 'src/app.css' ,
130130 content : ( { content } ) => {
131- const { ast, generateCode } = parseCss ( content ) ;
132131 const layerImports = [ 'base' , 'components' , 'utilities' ] . map (
133- ( layer ) => `" tailwindcss/${ layer } " `
132+ ( layer ) => `tailwindcss/${ layer } `
134133 ) ;
134+ if ( layerImports . every ( ( i ) => content . includes ( i ) ) ) {
135+ return content ;
136+ }
137+
138+ const { ast, generateCode } = parseCss ( content ) ;
135139 const originalFirst = ast . first ;
136140
137- const nodes = addImports ( ast , layerImports ) ;
141+ const specifiers = layerImports . map ( ( i ) => `'${ i } '` ) ;
142+ const nodes = addImports ( ast , specifiers ) ;
138143
139144 if (
140145 originalFirst !== ast . first &&
Original file line number Diff line number Diff line change @@ -508,6 +508,7 @@ async function runAdders({
508508 // and adders with dependencies runs later on, based on the adders they depend on.
509509 // based on https://stackoverflow.com/a/72030336/16075084
510510 details . sort ( ( a , b ) => {
511+ if ( ! a . dependsOn && ! b . dependsOn ) return 0 ;
511512 if ( ! a . dependsOn ) return - 1 ;
512513 if ( ! b . dependsOn ) return 1 ;
513514
You can’t perform that action at this time.
0 commit comments