audio-vis/build/task/jsonMinifier.js

26 lines
646 B
JavaScript
Raw Permalink Normal View History

2020-04-07 21:44:46 +02:00
const gulp = require('gulp'),
fs = require('fs')
const basePath = __dirname + '/../../raw/gui/';
const config = {
src: basePath + '*.json',
dest: __dirname + '/../../out/gui/'
}
function build() {
fs.readdirSync(basePath).forEach(file => {
try {
if (fs.lstatSync(basePath + file).isDirectory())
return
let content = fs.readFileSync(basePath + file).toString()
fs.writeFileSync(config.dest + file, JSON.stringify(JSON.parse(content)))
} catch (e) {
console.error(e)
}
})
return gulp.src(config.src)
}
module.exports.build = build;