@@ -210,31 +210,33 @@ async function run() {
210
210
)
211
211
212
212
// Split up stylesheets (as needed)
213
- try {
214
- await splitStylesheets ( stylesheets )
215
- } catch ( e : any ) {
216
- error ( `${ e ?. message ?? e } ` , { prefix : '↳ ' } )
217
- }
213
+ if ( version . isMajor ( 3 ) ) {
214
+ try {
215
+ await splitStylesheets ( stylesheets )
216
+ } catch ( e : any ) {
217
+ error ( `${ e ?. message ?? e } ` , { prefix : '↳ ' } )
218
+ }
218
219
219
- // Cleanup `@import "…" layer(utilities)`
220
- for ( let sheet of stylesheets ) {
221
- for ( let importRule of sheet . importRules ) {
222
- if ( ! importRule . raws . tailwind_injected_layer ) continue
223
- let importedSheet = stylesheets . find (
224
- ( sheet ) => sheet . id === importRule . raws . tailwind_destination_sheet_id ,
225
- )
226
- if ( ! importedSheet ) continue
227
-
228
- // Only remove the `layer(…)` next to the import if any of the children
229
- // contain `@utility`. Otherwise `@utility` will not be top-level.
230
- if (
231
- ! importedSheet . containsRule ( ( node ) => node . type === 'atrule' && node . name === 'utility' )
232
- ) {
233
- continue
234
- }
220
+ // Cleanup `@import "…" layer(utilities)`
221
+ for ( let sheet of stylesheets ) {
222
+ for ( let importRule of sheet . importRules ) {
223
+ if ( ! importRule . raws . tailwind_injected_layer ) continue
224
+ let importedSheet = stylesheets . find (
225
+ ( sheet ) => sheet . id === importRule . raws . tailwind_destination_sheet_id ,
226
+ )
227
+ if ( ! importedSheet ) continue
228
+
229
+ // Only remove the `layer(…)` next to the import if any of the children
230
+ // contain `@utility`. Otherwise `@utility` will not be top-level.
231
+ if (
232
+ ! importedSheet . containsRule ( ( node ) => node . type === 'atrule' && node . name === 'utility' )
233
+ ) {
234
+ continue
235
+ }
235
236
236
- // Make sure to remove the `layer(…)` from the `@import` at-rule
237
- importRule . params = importRule . params . replace ( / l a y e r \( [ ^ ) ] + \) / , '' ) . trim ( )
237
+ // Make sure to remove the `layer(…)` from the `@import` at-rule
238
+ importRule . params = importRule . params . replace ( / l a y e r \( [ ^ ) ] + \) / , '' ) . trim ( )
239
+ }
238
240
}
239
241
}
240
242
0 commit comments