naive-ui/scripts/post-build/terse-cssr.js

19 lines
456 B
JavaScript
Raw Normal View History

2021-02-03 20:20:00 +08:00
const fs = require('fs').promises
2021-02-03 21:38:43 +08:00
const terseCssr = require('../../build/utils/terse-cssr.js')
const { walk, outDirs } = require('../utils')
2021-02-03 20:20:00 +08:00
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()
}