Extract all into file per layer, concatenate to single file
This commit is contained in:
parent
9c3682294e
commit
182edb2ee1
52 changed files with 10344 additions and 2200 deletions
16
gulpfile.js
16
gulpfile.js
|
|
@ -24,6 +24,7 @@ var modifyCssUrls = require('gulp-modify-css-urls');
|
|||
var sort = require('gulp-sort');
|
||||
var scanner = require('i18next-scanner');
|
||||
var jsonConcat = require('gulp-json-concat');
|
||||
var rename = require("gulp-rename");
|
||||
|
||||
var debug = false;
|
||||
|
||||
|
|
@ -54,6 +55,8 @@ var paths = {
|
|||
images: mainNpmFiles().filter(f => RegExp('.*.+(png|gif|svg)', 'i').test(f)),
|
||||
fonts: mainNpmFiles().filter(f => RegExp('font-awesome/fonts/.*', 'i').test(f)),
|
||||
locales: 'locales/*.json',
|
||||
layers: 'layers/**/*.geojson',
|
||||
layersDestName: 'layers.js',
|
||||
dest: 'dist',
|
||||
destName: 'brouter-web'
|
||||
};
|
||||
|
|
@ -163,7 +166,7 @@ gulp.task('inject', function () {
|
|||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('default', ['clean', 'scripts_config', 'scripts', 'styles', 'images', 'fonts', 'locales']);
|
||||
gulp.task('default', ['clean', 'scripts_config', 'layers', 'scripts', 'styles', 'images', 'fonts', 'locales']);
|
||||
|
||||
gulp.task('debug', function() {
|
||||
debug = true;
|
||||
|
|
@ -274,10 +277,13 @@ gulp.task('i18next', function() {
|
|||
.pipe(gulp.dest('.'));
|
||||
})
|
||||
|
||||
// Bundles layer files. To download and extract run "yarn layers"
|
||||
gulp.task('layers', function () {
|
||||
return gulp.src('layers/extra/**/*.json')
|
||||
.pipe(jsonConcat('layers-extra.js', function(data){
|
||||
return Buffer.from('Object.assign(BR.layerIndex, ' + JSON.stringify(data, null, 4) + ');');
|
||||
return gulp.src(paths.layers)
|
||||
// Workaround to get file extension removed from the dictionary key
|
||||
.pipe(rename({ extname: ".json" }))
|
||||
.pipe(jsonConcat(paths.layersDestName, function(data){
|
||||
return Buffer.from('BR.layerIndex = ' + JSON.stringify(data, null, 2) + ';');
|
||||
}))
|
||||
.pipe(gulp.dest('layers'));
|
||||
.pipe(gulp.dest(paths.dest));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue