Skip to content

Commit 691ed02

Browse files
authored
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified * unify JIT and AOT codepaths * ensure `Object.entries` on undefined doesn't break It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value. * drop AOT specific tests These tests are all covered by JIT mode already and were AOT specific. * simplify tests, and add a few Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output. Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging. * add some todo's to make sure we warn in a few cases * make `darkMode: 'media'`, the default This also includes moving dark mode tests to its own dedicated file. * remove PostCSS 7 compat mode * update CLI to be JIT-first * fix integration tests This is not a _real_ fix, but it does solve the broken test for now. * warn when using @Responsive or @Variants * remove the JIT preview warning * remove AOT-only code paths * remove all `mode: 'jit'` blocks Also remove `variants: {}` since they are not useful in `JIT` mode anymore. * drop unused dependencies * rename `purge` to `content` * remove static CDN builds * mark `--purge` as deprecated in the CLI This will still work, but a warning will be printed and it won't show up in the `--help` output. * cleanup nesting plugin We don't have to duplicate it anymore since there is no PostCSS 7 version anymore. * make sure integration tests run in band * cleanup folder structure * make sure nesting folder is available * simplify resolving of purge/content information
1 parent 911e755 commit 691ed02

File tree

141 files changed

+1959
-10577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1959
-10577
lines changed

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ index.html
1010
yarn.lock
1111
yarn-error.log
1212

13-
# "External" plugins
14-
/nesting
15-
1613
# Perf related files
1714
isolate*.log
1815

1916
# Generated files
20-
/src/corePluginList.js
17+
/src/corePluginList.js

dist/.gitignore

-3
This file was deleted.

dist/.npmignore

Whitespace-only changes.

integrations/parcel/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "parcel build ./src/index.html --no-cache",
77
"dev": "parcel watch ./src/index.html --no-cache",
8-
"test": "jest"
8+
"test": "jest --runInBand"
99
},
1010
"jest": {
1111
"displayName": "parcel",

integrations/parcel/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./src/index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./src/index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/parcel/tests/integration.test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ describe.skip('watcher', () => {
127127
'../tailwind.config.js',
128128
javascript`
129129
module.exports = {
130-
purge: ['./src/index.html'],
131-
mode: 'jit',
132-
darkMode: false, // or 'media' or 'class'
130+
content: ['./src/index.html'],
133131
theme: {
134132
extend: {
135133
screens: {
@@ -140,9 +138,6 @@ describe.skip('watcher', () => {
140138
}
141139
},
142140
},
143-
variants: {
144-
extend: {},
145-
},
146141
corePlugins: {
147142
preflight: false,
148143
},

integrations/postcss-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.0",
55
"scripts": {
66
"build": "NODE_ENV=production postcss ./src/index.css -o ./dist/main.css",
7-
"test": "jest"
7+
"test": "jest --runInBand"
88
},
99
"jest": {
1010
"displayName": "PostCSS CLI",

integrations/postcss-cli/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./src/index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./src/index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/postcss-cli/tests/integration.test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ describe('watcher', () => {
109109
'../tailwind.config.js',
110110
javascript`
111111
module.exports = {
112-
purge: ['./src/index.html'],
113-
mode: 'jit',
114-
darkMode: false, // or 'media' or 'class'
112+
content: ['./src/index.html'],
115113
theme: {
116114
extend: {
117115
screens: {
@@ -122,9 +120,6 @@ describe('watcher', () => {
122120
}
123121
},
124122
},
125-
variants: {
126-
extend: {},
127-
},
128123
corePlugins: {
129124
preflight: false,
130125
},

integrations/rollup/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.0",
55
"scripts": {
66
"build": "rollup -c",
7-
"test": "jest"
7+
"test": "jest --runInBand"
88
},
99
"jest": {
1010
"displayName": "rollup.js",

integrations/rollup/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./src/index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./src/index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/rollup/tests/integration.test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ describe.each([{ TAILWIND_MODE: 'watch' }, { TAILWIND_MODE: undefined }])('watch
105105
'../tailwind.config.js',
106106
javascript`
107107
module.exports = {
108-
purge: ['./src/index.html'],
109-
mode: 'jit',
110-
darkMode: false, // or 'media' or 'class'
108+
content: ['./src/index.html'],
111109
theme: {
112110
extend: {
113111
screens: {
@@ -118,9 +116,6 @@ describe.each([{ TAILWIND_MODE: 'watch' }, { TAILWIND_MODE: undefined }])('watch
118116
}
119117
},
120118
},
121-
variants: {
122-
extend: {},
123-
},
124119
corePlugins: {
125120
preflight: false,
126121
},

integrations/tailwindcss-cli/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./src/index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./src/index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/tailwindcss-cli/tests/cli.test.js

+4-39
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,14 @@ describe('Build command', () => {
115115

116116
let customConfig = `module.exports = ${JSON.stringify(
117117
{
118-
purge: ['./src/index.html'],
119-
mode: 'jit',
120-
darkMode: false, // or 'media' or 'class'
118+
content: ['./src/index.html'],
121119
theme: {
122120
extend: {
123121
fontWeight: {
124122
bold: 'BOLD',
125123
},
126124
},
127125
},
128-
variants: {
129-
extend: {},
130-
},
131126
corePlugins: {
132127
preflight: false,
133128
},
@@ -258,7 +253,7 @@ describe('Build command', () => {
258253

259254
expect(combined).toMatchInlineSnapshot(`
260255
"
261-
tailwindcss v2.2.8
256+
tailwindcss v2.2.9
262257
263258
Usage:
264259
tailwindcss build [options]
@@ -267,8 +262,7 @@ describe('Build command', () => {
267262
-i, --input Input file
268263
-o, --output Output file
269264
-w, --watch Watch for changes and rebuild as needed
270-
--jit Build using JIT mode
271-
--purge Content paths to use for removing unused classes
265+
--content Content paths to use for removing unused classes
272266
--postcss Load custom PostCSS configuration
273267
-m, --minify Minify the output
274268
-c, --config Path to a custom config file
@@ -298,34 +292,6 @@ describe('Init command', () => {
298292
expect((await readOutputFile('../full.config.js')).split('\n').length).toBeGreaterThan(50)
299293
})
300294

301-
test('--jit', async () => {
302-
cleanupFile('with-jit.config.js')
303-
304-
let { combined } = await $(`${EXECUTABLE} init with-jit.config.js --jit`)
305-
306-
expect(combined).toMatchInlineSnapshot(`
307-
"
308-
Created Tailwind CSS config file: with-jit.config.js
309-
"
310-
`)
311-
312-
expect(await readOutputFile('../with-jit.config.js')).toContain("mode: 'jit'")
313-
})
314-
315-
test('--full, --jit', async () => {
316-
cleanupFile('full-with-jit.config.js')
317-
318-
let { combined } = await $(`${EXECUTABLE} init full-with-jit.config.js --jit --full`)
319-
320-
expect(combined).toMatchInlineSnapshot(`
321-
"
322-
Created Tailwind CSS config file: full-with-jit.config.js
323-
"
324-
`)
325-
326-
expect(await readOutputFile('../full-with-jit.config.js')).toContain("mode: 'jit'")
327-
})
328-
329295
test('--postcss', async () => {
330296
expect(await fileExists('postcss.config.js')).toBe(true)
331297
await removeFile('postcss.config.js')
@@ -348,13 +314,12 @@ describe('Init command', () => {
348314

349315
expect(combined).toMatchInlineSnapshot(`
350316
"
351-
tailwindcss v2.2.8
317+
tailwindcss v2.2.9
352318
353319
Usage:
354320
tailwindcss init [options]
355321
356322
Options:
357-
--jit Initialize for JIT mode
358323
-f, --full Initialize a full \`tailwind.config.js\` file
359324
-p, --postcss Initialize a \`postcss.config.js\` file
360325
-h, --help Display usage information

integrations/tailwindcss-cli/tests/integration.test.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,14 @@ describe('static build', () => {
3232
'../tailwind.config.js',
3333
javascript`
3434
module.exports = {
35-
purge: {
35+
content: {
3636
content: ['./src/index.html'],
3737
safelist: ['bg-red-500','bg-red-600']
3838
},
39-
mode: 'jit',
40-
darkMode: false, // or 'media' or 'class'
4139
theme: {
4240
extend: {
4341
},
4442
},
45-
variants: {
46-
extend: {},
47-
},
4843
corePlugins: {
4944
preflight: false,
5045
},
@@ -212,9 +207,7 @@ describe('watcher', () => {
212207
'../tailwind.config.js',
213208
javascript`
214209
module.exports = {
215-
purge: ['./src/index.html'],
216-
mode: 'jit',
217-
darkMode: false, // or 'media' or 'class'
210+
content: ['./src/index.html'],
218211
theme: {
219212
extend: {
220213
screens: {
@@ -225,9 +218,6 @@ describe('watcher', () => {
225218
}
226219
},
227220
},
228-
variants: {
229-
extend: {},
230-
},
231221
corePlugins: {
232222
preflight: false,
233223
},

integrations/vite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"browser": "./src/index.js",
77
"scripts": {
88
"build": "vite build",
9-
"test": "jest"
9+
"test": "jest --runInBand"
1010
},
1111
"jest": {
1212
"displayName": "vite",

integrations/vite/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/vite/tests/integration.test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ describe('watcher', () => {
132132
'tailwind.config.js',
133133
javascript`
134134
module.exports = {
135-
purge: ['./index.html'],
136-
mode: 'jit',
137-
darkMode: false, // or 'media' or 'class'
135+
content: ['./index.html'],
138136
theme: {
139137
extend: {
140138
screens: {
@@ -145,9 +143,6 @@ describe('watcher', () => {
145143
}
146144
},
147145
},
148-
variants: {
149-
extend: {},
150-
},
151146
corePlugins: {
152147
preflight: false,
153148
},

integrations/webpack-4/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "webpack --mode=production",
99
"dev": "webpack --mode=development --watch",
10-
"test": "jest"
10+
"test": "jest --runInBand"
1111
},
1212
"jest": {
1313
"displayName": "webpack 4",

integrations/webpack-4/tailwind.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module.exports = {
2-
purge: ['./src/index.html'],
3-
mode: 'jit',
4-
darkMode: false, // or 'media' or 'class'
2+
content: ['./src/index.html'],
53
theme: {
64
extend: {},
75
},
8-
variants: {
9-
extend: {},
10-
},
116
corePlugins: {
127
preflight: false,
138
},

integrations/webpack-4/tests/integration.test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ describe.each([{ TAILWIND_MODE: 'watch' }, { TAILWIND_MODE: undefined }])('watch
103103
'../tailwind.config.js',
104104
javascript`
105105
module.exports = {
106-
purge: ['./src/index.html'],
107-
mode: 'jit',
108-
darkMode: false, // or 'media' or 'class'
106+
content: ['./src/index.html'],
109107
theme: {
110108
extend: {
111109
screens: {
@@ -116,9 +114,6 @@ describe.each([{ TAILWIND_MODE: 'watch' }, { TAILWIND_MODE: undefined }])('watch
116114
}
117115
},
118116
},
119-
variants: {
120-
extend: {},
121-
},
122117
corePlugins: {
123118
preflight: false,
124119
},

0 commit comments

Comments
 (0)