[TASK] Support comments in config.json

This commit is contained in:
Xaver Maierhofer 2016-06-16 20:35:09 +02:00
parent 3d2b4e7f84
commit 4347db2c3a
5 changed files with 29 additions and 10 deletions

View File

@ -3,7 +3,7 @@ module.exports = function (grunt) {
grunt.loadTasks("tasks"); grunt.loadTasks("tasks");
grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass:dist", "postcss", "requirejs:default", "inlinedata", "cachebreaker", "inline", "clean:release"]); grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass:dist", "postcss", "requirejs:default", "inlinedata", "cachebreaker", "inline", "htmlmin", "clean:release"]);
grunt.registerTask("lint", ["sasslint", "eslint"]); grunt.registerTask("lint", ["sasslint", "eslint"]);
grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass:dev", "postcss", "requirejs:dev", "inlinedata", "browserSync", "watch"]); grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass:dev", "postcss", "requirejs:dev", "inlinedata", "htmlmin", "browserSync", "watch"]);
}; };

View File

@ -1,4 +1,6 @@
// Grunt will remove all comments
{ {
// Variables are NODE_ID and NODE_NAME (only a-z0-9\- other chars are replaced with _)
"nodeInfos": [ "nodeInfos": [
{ {
"name": "Clientstatistik", "name": "Clientstatistik",
@ -21,6 +23,7 @@
"caption": "Jahresstatistik - weiteren Statistiken" "caption": "Jahresstatistik - weiteren Statistiken"
} }
], ],
// String or array of data provider are supported
"dataPath": "https://regensburg.freifunk.net/data/", "dataPath": "https://regensburg.freifunk.net/data/",
"siteName": "Freifunk Regensburg", "siteName": "Freifunk Regensburg",
"mapSigmaScale": 0.5, "mapSigmaScale": 0.5,
@ -29,7 +32,8 @@
"mapLayers": [ "mapLayers": [
{ {
"name": "HERE", "name": "HERE",
"url": "https://{s}.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?app_id=Q40ik5rnMQOpOQ6RrHCr&app_code=kIPJpCtUZMTiQQJiCemX6Q&lg=deu", // Please use your own API key - Free plan is on right side after the pay plans
"url": "https://{s}.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?app_id=YOUR_KEY&app_code=YOUR_CODE&lg=deu",
"config": { "config": {
"attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>", "attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>",
"subdomains": "1234", "subdomains": "1234",
@ -54,7 +58,8 @@
}, },
{ {
"name": "HERE.hybridDay", "name": "HERE.hybridDay",
"url": "https://{s}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/{variant}/{z}/{x}/{y}/256/png8?app_id=Q40ik5rnMQOpOQ6RrHCr&app_code=kIPJpCtUZMTiQQJiCemX6Q&lg=deu", // Please use your own API key - Free plan is on right side after the pay plans
"url": "https://{s}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/{variant}/{z}/{x}/{y}/256/png8?app_id=YOUR_KEY&app_code=YOUR_CODE&lg=deu",
"config": { "config": {
"attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>", "attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>",
"subdomains": "1234", "subdomains": "1234",

View File

@ -22,6 +22,7 @@
"grunt-check-dependencies": "^0.12.0", "grunt-check-dependencies": "^0.12.0",
"grunt-contrib-clean": "^1.0.0", "grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0", "grunt-contrib-copy": "^1.0.0",
"grunt-contrib-htmlmin": "^1.4.0",
"grunt-contrib-requirejs": "^1.0.0", "grunt-contrib-requirejs": "^1.0.0",
"grunt-contrib-watch": "^1.0.0", "grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^18.1.0", "grunt-eslint": "^18.1.0",

View File

@ -89,6 +89,18 @@ module.exports = function (grunt) {
dest: "build/index.html" dest: "build/index.html"
} }
}, },
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true
},
files: {
'build/index.html': 'build/index.html'
}
}
},
inlinedata: { inlinedata: {
injs: { injs: {
expand: true, expand: true,
@ -153,5 +165,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-postcss"); grunt.loadNpmTasks("grunt-postcss");
grunt.loadNpmTasks("grunt-inline"); grunt.loadNpmTasks("grunt-inline");
grunt.loadNpmTasks("grunt-inline-data"); grunt.loadNpmTasks("grunt-inline-data");
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks("grunt-cache-breaker"); grunt.loadNpmTasks("grunt-cache-breaker");
}; };

View File

@ -24,8 +24,8 @@ module.exports = function (grunt) {
}, },
watch: { watch: {
html: { html: {
files: ["html/index.html"], files: ["html/index.html", "config.json"],
tasks: ["copy", "inlinedata"] tasks: ["copy", "inlinedata", "htmlmin"]
}, },
sass: { sass: {
files: ["scss/**/*.scss"], files: ["scss/**/*.scss"],