Restructured json files

This commit is contained in:
Stephan 2019-03-19 19:43:07 +01:00
parent 22405b61c9
commit f0724ab056
2 changed files with 9 additions and 10 deletions

View file

@ -41,11 +41,7 @@ const input = {
root: 'source', root: 'source',
screens: 'source/screens/**/*.+(njk|html)', screens: 'source/screens/**/*.+(njk|html)',
templates: 'source/templates', templates: 'source/templates',
data: { data: 'source/data/**/*.json',
template: 'source/data/template.json',
app: ['source/data/**/*.json', '!source/data/template.json'],
watch: 'source/data/**/*.json',
},
style: 'source/style/**/*.s+(a|c)ss', style: 'source/style/**/*.s+(a|c)ss',
code: ['source/code/hippie/variables.js', 'source/code/hippie/functions.js', 'source/code/hippie/global.js', '!source/vendor/**/*'], code: ['source/code/hippie/variables.js', 'source/code/hippie/functions.js', 'source/code/hippie/global.js', '!source/vendor/**/*'],
fonts: 'node_modules/@fortawesome/fontawesome-free/webfonts/**/*', fonts: 'node_modules/@fortawesome/fontawesome-free/webfonts/**/*',
@ -54,7 +50,10 @@ const input = {
sprites: 'source/art/sprites/**/*.png', sprites: 'source/art/sprites/**/*.png',
images: 'source/art/images/**/*.+(png|gif|jpg)' images: 'source/art/images/**/*.+(png|gif|jpg)'
}, },
vendor: 'vendor/**/*' vendor: 'vendor/**/*',
demo: {
data: 'source/templates/demo/data.json'
}
}; };
const output = { const output = {
@ -87,7 +86,7 @@ function reload(done) {
// Concatenate JSON files // Concatenate JSON files
function json() { function json() {
return src(input.data.app) return src(input.data)
.pipe(plumber()) .pipe(plumber())
.pipe(jsonConcat(hippie.jsonFile +'.json', function(data) { .pipe(jsonConcat(hippie.jsonFile +'.json', function(data) {
return new Buffer(JSON.stringify(data)); return new Buffer(JSON.stringify(data));
@ -100,7 +99,7 @@ function nunjucks() {
return src(input.screens) return src(input.screens)
.pipe(plumber()) .pipe(plumber())
.pipe(data(function() { .pipe(data(function() {
let data = JSON.parse(fs.readFileSync(input.data.template)); let data = JSON.parse(fs.readFileSync(input.demo.data));
object = {hippie, data}; object = {hippie, data};
return object; return object;
})) }))
@ -219,12 +218,12 @@ function vendor() {
} }
function overview() { function overview() {
watch([input.screens, input.data.template], series(nunjucks, reload)); watch([input.screens, input.demo.data], series(nunjucks, reload));
watch(input.style, series(styleLint, style, reload)); watch(input.style, series(styleLint, style, reload));
watch(input.code, series(codeLint, code, reload)); watch(input.code, series(codeLint, code, reload));
watch(input.fonts, series(fonts, reload)); watch(input.fonts, series(fonts, reload));
watch([input.art.favicons, input.art.sprites, input.art.images], series(art, reload)); watch([input.art.favicons, input.art.sprites, input.art.images], series(art, reload));
watch(input.data.app, series(json, reload)); watch(input.data, series(json, reload));
} }
const assets = parallel(fonts, art, vendor); const assets = parallel(fonts, art, vendor);