Concatena JSON de rutas usando Gulp

This commit is contained in:
Juan Ferrer Toribio 2016-10-06 11:18:02 +02:00
parent d1a86633fc
commit 287fd05864
7 changed files with 32 additions and 3 deletions

View File

@ -0,0 +1,4 @@
{
"route": "buys",
"template": "buys.template"
}

View File

@ -0,0 +1,4 @@
{
"route": "sales",
"template": "sales.template"
}

16
gulpfile.js Normal file
View File

@ -0,0 +1,16 @@
var gulp = require ('gulp');
var jsoncombine = require ('gulp-jsoncombine');
function combineFunc (data)
{
return new Buffer (JSON.stringify (data));
}
gulp.task ('default', function ()
{
var json = gulp.src ('./@salix/**/routing.json')
.pipe (jsoncombine ('salix.routes.json', combineFunc))
.pipe (gulp.dest ('./build'));
});

View File

@ -19,7 +19,9 @@
"babel-core": "*", "babel-core": "*",
"babel-preset-es2015": "*", "babel-preset-es2015": "*",
"babel-loader": "*", "babel-loader": "*",
"raw-loader": "*" "raw-loader": "*",
"gulp": "^3.9.1",
"gulp-jsoncombine": "^1.0.3"
}, },
"scripts": { "scripts": {
"dev": "webpack --progress --colors --watch" "dev": "webpack --progress --colors --watch"

0
server.js Normal file
View File

View File

@ -22,9 +22,12 @@ module.exports =
query: { query: {
presets: ['es2015'] presets: ['es2015']
} }
}, { },{
test: /\.html$/, test: /\.html$/,
loader: 'raw' loader: 'raw'
},{
test: /\.json$/,
loader: 'json'
} }
] ]
}, },