forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
29 lines (26 loc) · 787 Bytes
/
build.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
import fs from 'fs'
import postcss from 'postcss'
import tailwind from '..'
import CleanCSS from 'clean-css'
console.info('Building Tailwind!')
fs.readFile('./css/tailwind.css', (err, css) => {
postcss([tailwind()])
.process(css, {
from: './css/tailwind.css',
to: './dist/tailwind.css',
map: { inline: false },
})
.then(result => {
fs.writeFileSync('./dist/tailwind.css', result.css)
if (result.map) {
fs.writeFileSync('./dist/tailwind.css.map', result.map)
}
return result
})
.then(result => {
const minified = new CleanCSS().minify(result.css)
fs.writeFileSync('./dist/tailwind.min.css', minified.styles)
})
.catch(error => console.log(error))
})
console.log('Finished Building Tailwind!')