-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathbuild.js
36 lines (33 loc) · 899 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
30
31
32
33
34
35
36
const fs = require('fs')
const postcss = require('postcss')
const tailwind = require('tailwindcss')
const CleanCSS = require('clean-css')
function buildDistFile(filename) {
return postcss([
tailwind({
corePlugins: false,
plugins: [require('../src/index.js')],
}),
require('autoprefixer'),
])
.process('@tailwind utilities', {
from: null,
to: `./dist/${filename}.css`,
map: false,
})
.then((result) => {
fs.writeFileSync(`./dist/${filename}.css`, result.css)
return result
})
.then((result) => {
const minified = new CleanCSS().minify(result.css)
fs.writeFileSync(`./dist/${filename}.min.css`, minified.styles)
})
.catch((error) => {
console.log(error)
})
}
console.info('Building CSS...')
Promise.all([buildDistFile('line-clamp')]).then(() => {
console.log('Finished building CSS.')
})