diff --git a/Gruntfile.js b/Gruntfile.js index 0922dffd8909915e1422b7a30de9024928a53539..28e26fbdcd2adfb92c5d4cc247a1396ef5cc2942 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,7 +3,7 @@ module.exports = function (grunt) { grunt.loadTasks("tasks"); - grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "cachebreaker", "inline"]); + grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "inlinedata", "cachebreaker", "inline"]); grunt.registerTask("lint", ["sasslint", "eslint"]); - grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass", "requirejs:dev", "browserSync", "watch"]); + grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass", "requirejs:dev", "inlinedata", "browserSync", "watch"]); }; diff --git a/app.js b/app.js index 0e333ddea1dfd5997c12b8e225ecdc40d2559274..4fcc59617a10e7d595d75c1158a12711ec4d3b0c 100644 --- a/app.js +++ b/app.js @@ -23,6 +23,6 @@ require.config({ } }); -require(["main", "helper"], function (main, helper) { - helper.getJSON("config.json").then(main); +require(["main"], function (main) { + main(jsonData); }); diff --git a/html/index.html b/html/index.html index 874085fa6d6380ee5c150a1db0d064fd04741757..6ffdd665353185a7ab56f141f3a007e396dbd29a 100644 --- a/html/index.html +++ b/html/index.html @@ -6,6 +6,9 @@ <link rel="stylesheet" href="roboto-slab-fontface.css"> <link rel="stylesheet" href="css/roboto-fontface.css"> <link rel="stylesheet" href="style.css?__inline=true"> + <script> + var jsonData = __inline(config.json); + </script> <script src="vendor/es6-shim/es6-shim.min.js?__inline=true"></script> <script src="app.js"></script> </head> diff --git a/package.json b/package.json index 5315e6eae9ee547a6f517ba692c3c1ed440a3cad..3eb255665d3050b84fa9c8e88a6506f605813a4e 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "grunt-contrib-watch": "^1.0.0", "grunt-eslint": "^18.1.0", "grunt-inline": "^0.3.6", + "grunt-inline-data": "0.0.6", "grunt-postcss": "^0.8.0", "grunt-sass": "^1.2.0", "grunt-sass-lint": "^0.2.0" diff --git a/tasks/build.js b/tasks/build.js index 5dd7edd35ba3bb46cacd310536af2a1e0c63d0c1..b392c86d82c8536743c478aff3c3c081f6e04dd7 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -17,6 +17,12 @@ module.exports = function (grunt) { cwd: "bower_components/", dest: "build/vendor/" }, + config: { + src: ["config.json"], + expand: true, + cwd: ".", + dest: "build/" + }, robotoSlab: { src: ["fonts/*", "roboto-slab-fontface.css" @@ -74,6 +80,14 @@ module.exports = function (grunt) { dest: "build/index.html" } }, + inlinedata: { + injs: { + expand: true, + cwd: '.', + src: ['build/*.html'], + ext: '.html' + } + }, "bower-install-simple": { options: { directory: "<%=bowerdir%>", @@ -128,5 +142,6 @@ module.exports = function (grunt) { grunt.loadNpmTasks("grunt-sass"); grunt.loadNpmTasks("grunt-postcss"); grunt.loadNpmTasks("grunt-inline"); + grunt.loadNpmTasks('grunt-inline-data'); grunt.loadNpmTasks("grunt-cache-breaker"); }; diff --git a/tasks/development.js b/tasks/development.js index 6192b91fc5b415c18243925f92ac4e95e7a963b5..7c05451b4dc4d46b53e5cf9f75e276995e9718cb 100644 --- a/tasks/development.js +++ b/tasks/development.js @@ -25,7 +25,7 @@ module.exports = function (grunt) { watch: { html: { files: ["html/index.html"], - tasks: ["copy"] + tasks: ["copy", "inlinedata"] }, sass: { files: ["scss/**/*.scss"],