[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.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("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": [
{
"name": "Clientstatistik",
@ -21,6 +23,7 @@
"caption": "Jahresstatistik - weiteren Statistiken"
}
],
// String or array of data provider are supported
"dataPath": "https://regensburg.freifunk.net/data/",
"siteName": "Freifunk Regensburg",
"mapSigmaScale": 0.5,
@ -29,7 +32,8 @@
"mapLayers": [
{
"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": {
"attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>",
"subdomains": "1234",
@ -54,7 +58,8 @@
},
{
"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": {
"attribution": "Map &copy; 1987-2014 <a href=\"http://developer.here.com\">HERE</a>",
"subdomains": "1234",

View File

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

View File

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

View File

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