@@ -231,3 +231,50 @@ To disable Preflight, simply omit its import while keeping everything else:
231
231
@import " tailwindcss/preflight.css" layer(base); /* [!code --] */
232
232
@import " tailwindcss/utilities.css" layer(utilities);
233
233
```
234
+
235
+ When importing Tailwind CSS's files individually, features like ` source() ` , ` theme() ` , ` prefix() ` , etc… should go on their respective imports.
236
+
237
+ Source detection affects generated utilities so ` source(…) ` should be added to the ` utilities.css ` import:
238
+
239
+ ``` css
240
+ /* [!code filename:CSS] */
241
+ @layer theme, base, components, utilities;
242
+
243
+ @import " tailwindcss/theme.css" layer(theme);
244
+ @import " tailwindcss/utilities.css" layer(utilities); /* [!code --] */
245
+ @import " tailwindcss/utilities.css" layer(utilities) source(none); /* [!code ++] */
246
+ ```
247
+
248
+ The same goes for ` important ` which affects generated utilities:
249
+
250
+ ``` css
251
+ /* [!code filename:CSS] */
252
+ @layer theme, base, components, utilities;
253
+
254
+ @import " tailwindcss/theme.css" layer(theme);
255
+ @import " tailwindcss/utilities.css" layer(utilities); /* [!code --] */
256
+ @import " tailwindcss/utilities.css" layer(utilities) important; /* [!code ++] */
257
+ ```
258
+
259
+ Likewise, ` theme(static) ` , ` theme(inline) ` , etc… affect generated theme variables and should be placed on the ` theme.css ` import:
260
+
261
+ ``` css
262
+ /* [!code filename:CSS] */
263
+ @layer theme, base, components, utilities;
264
+
265
+ @import " tailwindcss/theme.css" layer(theme); /* [!code --] */
266
+ @import " tailwindcss/theme.css" layer(theme) theme(static); /* [!code ++] */
267
+ @import " tailwindcss/utilities.css" layer(utilities);
268
+ ```
269
+
270
+ Using a prefix, e.g. ` prefix(tw) ` , affects * both* so it should go on both imports:
271
+
272
+ ``` css
273
+ /* [!code filename:CSS] */
274
+ @layer theme, base, components, utilities;
275
+
276
+ @import " tailwindcss/theme.css" layer(theme); /* [!code --] */
277
+ @import " tailwindcss/utilities.css" layer(utilities); /* [!code --] */
278
+ @import " tailwindcss/theme.css" layer(theme) prefix(tw); /* [!code ++] */
279
+ @import " tailwindcss/utilities.css" layer(utilities) prefix(tw); /* [!code ++] */
280
+ ```
0 commit comments