[TASK] Default and custom config - merge
This commit is contained in:
parent
6a3986e588
commit
c42758ba35
20
config.default.json
Normal file
20
config.default.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Gulp will remove all comments
|
||||||
|
{
|
||||||
|
"reverseGeocodingApi": "https://nominatim.openstreetmap.org/reverse",
|
||||||
|
"maxAge": 14,
|
||||||
|
"maxAgeAlert": 3,
|
||||||
|
"nodeZoom": 18,
|
||||||
|
"labelZoom": 13,
|
||||||
|
"clientZoom": 15,
|
||||||
|
"nodeInfobox": {
|
||||||
|
"contact": false,
|
||||||
|
"hardwareUsage": true
|
||||||
|
},
|
||||||
|
"supportedLocale": [
|
||||||
|
"en",
|
||||||
|
"de",
|
||||||
|
"fr",
|
||||||
|
"ru"
|
||||||
|
],
|
||||||
|
"cacheBreaker": "<!-- inject:cache-breaker -->"
|
||||||
|
}
|
23
config.json
23
config.json
@ -25,17 +25,7 @@
|
|||||||
],
|
],
|
||||||
// String or array of data provider are supported
|
// String or array of data provider are supported
|
||||||
"dataPath": "https://regensburg.freifunk.net/data/",
|
"dataPath": "https://regensburg.freifunk.net/data/",
|
||||||
"reverseGeocodingApi": "https://nominatim.openstreetmap.org/reverse",
|
|
||||||
"siteName": "Freifunk Regensburg",
|
"siteName": "Freifunk Regensburg",
|
||||||
"maxAge": 14,
|
|
||||||
"maxAgeAlert": 3,
|
|
||||||
"nodeZoom": 18,
|
|
||||||
"labelZoom": 13,
|
|
||||||
"clientZoom": 15,
|
|
||||||
"nodeInfobox": {
|
|
||||||
"contact": false,
|
|
||||||
"hardwareUsage": true
|
|
||||||
},
|
|
||||||
"mapLayers": [
|
"mapLayers": [
|
||||||
{
|
{
|
||||||
"name": "Freifunk Regensburg",
|
"name": "Freifunk Regensburg",
|
||||||
@ -44,7 +34,7 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"maxZoom": 22,
|
"maxZoom": 22,
|
||||||
"subdomains": "1234",
|
"subdomains": "1234",
|
||||||
"attribution": "<a href=\'https://www.mapbox.com/about/maps/\' target=\'_blank\'>© Mapbox</a> <a href=\'https://openstreetmap.org/about/\' target=\'_blank\'>© OpenStreetMap</a> <a class=\'mapbox-improve-map\' href=\'https://www.mapbox.com/map-feedback/\' target=\'_blank\'>Improve this map</a>",
|
"attribution": "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"https://openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>",
|
||||||
"start": 6
|
"start": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -55,7 +45,7 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"maxZoom": 22,
|
"maxZoom": 22,
|
||||||
"subdomains": "1234",
|
"subdomains": "1234",
|
||||||
"attribution": "<a href=\'https://www.mapbox.com/about/maps/\' target=\'_blank\'>© Mapbox</a> <a href=\'https://openstreetmap.org/about/\' target=\'_blank\'>© OpenStreetMap</a> <a class=\'mapbox-improve-map\' href=\'https://www.mapbox.com/map-feedback/\' target=\'_blank\'>Improve this map</a>",
|
"attribution": "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"https://openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>",
|
||||||
"mode": "night",
|
"mode": "night",
|
||||||
"start": 19,
|
"start": 19,
|
||||||
"end": 7
|
"end": 7
|
||||||
@ -121,12 +111,5 @@
|
|||||||
"site": "ffrgb",
|
"site": "ffrgb",
|
||||||
"name": "Regensburg"
|
"name": "Regensburg"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"supportedLocale": [
|
|
||||||
"en",
|
|
||||||
"de",
|
|
||||||
"fr",
|
|
||||||
"ru"
|
|
||||||
],
|
|
||||||
"cacheBreaker": "<!-- inject:cache-breaker -->"
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ module.exports = function () {
|
|||||||
sass: 'scss/**/*.scss',
|
sass: 'scss/**/*.scss',
|
||||||
javascript: ['app.js', 'lib/**/*.js'],
|
javascript: ['app.js', 'lib/**/*.js'],
|
||||||
json: 'locale/*.json',
|
json: 'locale/*.json',
|
||||||
html: ['html/index.html', 'config.json']
|
html: ['html/index.html', 'config.json', 'config.default.json']
|
||||||
},
|
},
|
||||||
clean: [build + '/*.map', build + '/vendor', build + '/main.css'],
|
clean: [build + '/*.map', build + '/vendor', build + '/main.css'],
|
||||||
autoprefixer: ['> 1% in DE'],
|
autoprefixer: ['> 1% in DE'],
|
||||||
|
@ -4,9 +4,14 @@ module.exports = function (gulp, plugins, config, env) {
|
|||||||
return gulp.src(env.production() ? config.build + '/*.html' : 'html/*.html')
|
return gulp.src(env.production() ? config.build + '/*.html' : 'html/*.html')
|
||||||
.pipe(plugins.inject(gulp.src(['config.json']), {
|
.pipe(plugins.inject(gulp.src(['config.json']), {
|
||||||
starttag: '<!-- inject:config -->',
|
starttag: '<!-- inject:config -->',
|
||||||
transform: function (filePath, file) {
|
transform: function (filePath, customConfig) {
|
||||||
|
var defaultConfig = fs.readFileSync('config.default.json', 'utf8');
|
||||||
|
var buildConfig = Object.assign(
|
||||||
|
JSON.parse(JSON.minify(defaultConfig)),
|
||||||
|
JSON.parse(JSON.minify(customConfig.contents.toString('utf8')))
|
||||||
|
);
|
||||||
return '<script>var jsonData =' +
|
return '<script>var jsonData =' +
|
||||||
file.contents.toString('utf8')
|
JSON.stringify(buildConfig)
|
||||||
.replace('<!-- inject:cache-breaker -->',
|
.replace('<!-- inject:cache-breaker -->',
|
||||||
Math.random().toString(12).substring(7)) +
|
Math.random().toString(12).substring(7)) +
|
||||||
';</script>'
|
';</script>'
|
||||||
|
Loading…
Reference in New Issue
Block a user