Skip to content

Commit e651dc3

Browse files
committed
update old config structure to new structure
1 parent 577fb12 commit e651dc3

File tree

6 files changed

+28
-48
lines changed

6 files changed

+28
-48
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ describe('static build', () => {
3434
javascript`
3535
module.exports = {
3636
content: {
37-
content: ['./src/index.html'],
38-
safelist: ['bg-red-500','bg-red-600']
37+
files: ['./src/index.html'],
3938
},
39+
safelist: ['bg-red-500','bg-red-600'],
4040
theme: {
4141
extend: {
4242
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ describe.each([{ TAILWIND_MODE: 'watch' }, { TAILWIND_MODE: undefined }])('watch
230230
javascript`
231231
module.exports = {
232232
content: {
233-
content: ['./src/index.html'],
234-
safelist: ['bg-red-500','bg-red-600']
233+
files: ['./src/index.html'],
235234
},
235+
safelist: ['bg-red-500','bg-red-600'],
236236
theme: {
237237
extend: {
238238
},

tests/color-opacity-modifiers.test.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ test('missing alpha generates nothing', async () => {
6262

6363
test('arbitrary color with opacity from scale', async () => {
6464
let config = {
65-
mode: 'jit',
66-
purge: [
67-
{
68-
raw: 'bg-[wheat]/50',
69-
},
70-
],
65+
content: [{ raw: 'bg-[wheat]/50' }],
7166
theme: {},
7267
plugins: [],
7368
}
@@ -85,12 +80,7 @@ test('arbitrary color with opacity from scale', async () => {
8580

8681
test('arbitrary color with arbitrary opacity', async () => {
8782
let config = {
88-
mode: 'jit',
89-
purge: [
90-
{
91-
raw: 'bg-[#bada55]/[0.2]',
92-
},
93-
],
83+
content: [{ raw: 'bg-[#bada55]/[0.2]' }],
9484
theme: {},
9585
plugins: [],
9686
}
@@ -108,12 +98,7 @@ test('arbitrary color with arbitrary opacity', async () => {
10898

10999
test('undefined theme color with opacity from scale', async () => {
110100
let config = {
111-
mode: 'jit',
112-
purge: [
113-
{
114-
raw: 'bg-garbage/50',
115-
},
116-
],
101+
content: [{ raw: 'bg-garbage/50' }],
117102
theme: {},
118103
plugins: [],
119104
}

tests/custom-extractors.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,26 @@ describe('modern', () => {
4141
expect(result.css).toMatchFormattedCss(expected)
4242
})
4343
})
44+
45+
test('extract function', () => {
46+
let config = {
47+
content: {
48+
files: [path.resolve(__dirname, './custom-extractors.test.html')],
49+
extract: customExtractor,
50+
},
51+
}
52+
53+
return run('@tailwind utilities', config).then((result) => {
54+
expect(result.css).toMatchFormattedCss(expected)
55+
})
56+
})
4457
})
4558

4659
describe('legacy', () => {
4760
test('defaultExtractor', () => {
4861
let config = {
4962
content: {
50-
content: [path.resolve(__dirname, './custom-extractors.test.html')],
63+
files: [path.resolve(__dirname, './custom-extractors.test.html')],
5164
options: {
5265
defaultExtractor: customExtractor,
5366
},
@@ -62,7 +75,7 @@ describe('legacy', () => {
6275
test('extractors array', () => {
6376
let config = {
6477
content: {
65-
content: [path.resolve(__dirname, './custom-extractors.test.html')],
78+
files: [path.resolve(__dirname, './custom-extractors.test.html')],
6679
options: {
6780
extractors: [
6881
{
@@ -78,17 +91,4 @@ describe('legacy', () => {
7891
expect(result.css).toMatchFormattedCss(expected)
7992
})
8093
})
81-
82-
test('extract function', () => {
83-
let config = {
84-
content: {
85-
content: [path.resolve(__dirname, './custom-extractors.test.html')],
86-
extract: customExtractor,
87-
},
88-
}
89-
90-
return run('@tailwind utilities', config).then((result) => {
91-
expect(result.css).toMatchFormattedCss(expected)
92-
})
93-
})
9494
})

tests/custom-transformers.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function customTransformer(content) {
77
test('transform function', () => {
88
let config = {
99
content: {
10-
content: [{ raw: html`<div class="uppercase"></div>` }],
10+
files: [{ raw: html`<div class="uppercase"></div>` }],
1111
transform: customTransformer,
1212
},
1313
}
@@ -24,7 +24,7 @@ test('transform function', () => {
2424
test('transform.DEFAULT', () => {
2525
let config = {
2626
content: {
27-
content: [{ raw: html`<div class="uppercase"></div>` }],
27+
files: [{ raw: html`<div class="uppercase"></div>` }],
2828
transform: {
2929
DEFAULT: customTransformer,
3030
},
@@ -43,7 +43,7 @@ test('transform.DEFAULT', () => {
4343
test('transform.{extension}', () => {
4444
let config = {
4545
content: {
46-
content: [
46+
files: [
4747
{ raw: html`<div class="uppercase"></div>`, extension: 'html' },
4848
{ raw: html`<div class="uppercase"></div>`, extension: 'php' },
4949
],

tests/raw-content.test.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,14 @@ test('raw content with extension', () => {
2929
let tailwind = require('../src')
3030
let config = {
3131
content: {
32-
content: [
32+
files: [
3333
{
3434
raw: fs.readFileSync(path.resolve(__dirname, './raw-content.test.html'), 'utf8'),
3535
extension: 'html',
3636
},
3737
],
38-
options: {
39-
extractors: [
40-
{
41-
extractor: () => ['invisible'],
42-
extensions: ['html'],
43-
},
44-
],
38+
extract: {
39+
html: () => ['invisible'],
4540
},
4641
},
4742
corePlugins: { preflight: false },

0 commit comments

Comments
 (0)