naive-ui/scripts/post-build/terse-cssr.js
2021-02-03 21:38:43 +08:00

19 lines
456 B
JavaScript

const fs = require('fs').promises
const terseCssr = require('../../build/utils/terse-cssr.js')
const { walk, outDirs } = require('../utils')
exports.terseCssr = async () => {
for (const dir of outDirs) {
for await (const p of walk(dir)) {
if (p.includes('.cssr.js')) {
const code = await fs.readFile(p, 'utf-8')
await fs.writeFile(p, terseCssr(code))
}
}
}
}
if (require.main === module) {
exports.terseCssr()
}