forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebuildFixtures.js
47 lines (42 loc) · 1.13 KB
/
rebuildFixtures.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import fs from 'fs'
import postcss from 'postcss'
import tailwind from '..'
function build({ from, to, config }) {
return new Promise((resolve, reject) => {
console.log(`Processing ./${from}...`)
fs.readFile(`./${from}`, (err, css) => {
if (err) throw err
return postcss([tailwind(config)])
.process(css, {
from: undefined,
})
.then(result => {
fs.writeFileSync(`./${to}`, result.css)
return result
})
.then(resolve)
.catch(error => {
console.log(error)
reject()
})
})
})
}
console.info('\nRebuilding fixtures...\n')
Promise.all([
build({
from: '__tests__/fixtures/tailwind-input.css',
to: '__tests__/fixtures/tailwind-output.css',
config: {},
}),
build({
from: '__tests__/fixtures/tailwind-input.css',
to: '__tests__/fixtures/tailwind-output-important.css',
config: { important: true },
}),
]).then(() => {
console.log('\nFinished rebuilding fixtures.')
console.log(
'\nPlease triple check that the fixture output matches what you expect before committing this change.'
)
})