2018-12-18 20:45:49 +00:00
|
|
|
import path from 'path'
|
|
|
|
import fs from 'fs'
|
2019-01-19 23:06:25 +00:00
|
|
|
import { promisify } from 'util'
|
2018-12-18 20:45:49 +00:00
|
|
|
import CleanCSS from 'clean-css'
|
|
|
|
|
2019-01-19 23:06:25 +00:00
|
|
|
const writeFile = promisify(fs.writeFile)
|
|
|
|
const readFile = promisify(fs.readFile)
|
|
|
|
const copyFile = promisify(fs.copyFile)
|
2018-12-18 20:45:49 +00:00
|
|
|
|
|
|
|
async function compileThirdPartyCss () {
|
|
|
|
let css = await readFile(path.resolve(__dirname, '../node_modules/emoji-mart/css/emoji-mart.css'), 'utf8')
|
2019-08-20 02:08:59 +00:00
|
|
|
css = '/* compiled from emoji-mart.css */' + new CleanCSS().minify(css).styles
|
2018-12-18 20:45:49 +00:00
|
|
|
await writeFile(path.resolve(__dirname, '../static/emoji-mart.css'), css, 'utf8')
|
|
|
|
}
|
|
|
|
|
|
|
|
async function compileThirdPartyJson () {
|
|
|
|
await copyFile(
|
|
|
|
path.resolve(__dirname, '../node_modules/emoji-mart/data/all.json'),
|
|
|
|
path.resolve(__dirname, '../static/emoji-mart-all.json')
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
async function main () {
|
|
|
|
await Promise.all([
|
|
|
|
compileThirdPartyCss(),
|
|
|
|
compileThirdPartyJson()
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
main().catch(err => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|