@@ -1023,81 +1023,3 @@ test(
10231023 expect ( content ) . toContain ( 'display: flex;' )
10241024 } ,
10251025)
1026-
1027- test (
1028- 'optimize option: respects NODE_ENV by default' ,
1029- {
1030- fs : {
1031- 'package.json' : json `
1032- {
1033- " type": "module",
1034- "dependencies": {
1035- "@tailwindcss / vite": "wor kspace: ^",
1036- "tailwindcss": "wor kspace: ^"
1037- },
1038- "devDependencies": {
1039- "vite": "^7"
1040- }
1041- }
1042- ` ,
1043- 'vite.config.ts' : ts `
1044- import tailwindcss from '@tailwindcss/vite'
1045- import { defineConfig } from 'vite'
1046-
1047- export default defineConfig({
1048- build: { cssMinify: false },
1049- plugins: [tailwindcss()],
1050- })
1051- ` ,
1052- 'index.html' : html `
1053- <head>
1054- <link rel=" stylesheet" href=" ./ src/ index.css " />
1055- </head>
1056- <body>
1057- <div class=" hover: text- [black ]">Hello, world!</div>
1058- </body>
1059- ` ,
1060- 'src/index.css' : css `
1061- @reference 'tailwindcss/theme';
1062- @import 'tailwindcss/utilities';
1063- ` ,
1064- } ,
1065- } ,
1066- async ( { exec, expect, fs } ) => {
1067- await exec ( 'pnpm vite build' , {
1068- env : { NODE_ENV : 'production' } ,
1069- } )
1070-
1071- let files = await fs . glob ( 'dist/**/*.css' )
1072- expect ( files ) . toHaveLength ( 1 )
1073- let [ filename ] = files [ 0 ]
1074-
1075- let content = await fs . read ( filename )
1076-
1077- // We disabled minficiation since that can apply similar optimizations as Lightning CSS
1078- expect ( content ) . toContain ( '@media (hover: hover) {' )
1079- expect ( content ) . toContain ( '.hover\\:text-\\[black\\]:hover {' )
1080-
1081- // But the hex color optimization is always applied by Lightning so we can verify that it ran
1082- expect ( content ) . toContain ( 'color: #000;' )
1083-
1084- await exec ( 'pnpm vite build' , {
1085- env : { NODE_ENV : 'development' } ,
1086- } )
1087-
1088- files = await fs . glob ( 'dist/**/*.css' )
1089- expect ( files ) . toHaveLength ( 1 )
1090- filename = files [ 0 ] [ 0 ]
1091-
1092- content = await fs . read ( filename )
1093-
1094- // We disabled minficiation since that can apply similar optimizations as Lightning CSS
1095- expect ( content ) . toContain ( '@media (hover: hover) {' )
1096- expect ( content ) . toContain ( '.hover\\:text-\\[black\\] {' )
1097- expect ( content ) . toContain ( '&:hover {' )
1098-
1099- // And note that the hex color optimization was also not applied
1100- // This validates that Lightning CSS did not run for development
1101- expect ( content ) . toContain ( 'color: black;' )
1102- } ,
1103- )
0 commit comments