[TASK] Inject config.json inline
This commit is contained in:
		
							parent
							
								
									1c69363233
								
							
						
					
					
						commit
						db8af292e3
					
				@ -3,7 +3,7 @@ module.exports = function (grunt) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  grunt.loadTasks("tasks");
 | 
					  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("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"]);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								app.js
									
									
									
									
									
								
							@ -23,6 +23,6 @@ require.config({
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require(["main", "helper"], function (main, helper) {
 | 
					require(["main"], function (main) {
 | 
				
			||||||
  helper.getJSON("config.json").then(main);
 | 
					  main(jsonData);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,9 @@
 | 
				
			|||||||
  <link rel="stylesheet" href="roboto-slab-fontface.css">
 | 
					  <link rel="stylesheet" href="roboto-slab-fontface.css">
 | 
				
			||||||
  <link rel="stylesheet" href="css/roboto-fontface.css">
 | 
					  <link rel="stylesheet" href="css/roboto-fontface.css">
 | 
				
			||||||
  <link rel="stylesheet" href="style.css?__inline=true">
 | 
					  <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="vendor/es6-shim/es6-shim.min.js?__inline=true"></script>
 | 
				
			||||||
  <script src="app.js"></script>
 | 
					  <script src="app.js"></script>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
				
			|||||||
@ -26,6 +26,7 @@
 | 
				
			|||||||
    "grunt-contrib-watch": "^1.0.0",
 | 
					    "grunt-contrib-watch": "^1.0.0",
 | 
				
			||||||
    "grunt-eslint": "^18.1.0",
 | 
					    "grunt-eslint": "^18.1.0",
 | 
				
			||||||
    "grunt-inline": "^0.3.6",
 | 
					    "grunt-inline": "^0.3.6",
 | 
				
			||||||
 | 
					    "grunt-inline-data": "0.0.6",
 | 
				
			||||||
    "grunt-postcss": "^0.8.0",
 | 
					    "grunt-postcss": "^0.8.0",
 | 
				
			||||||
    "grunt-sass": "^1.2.0",
 | 
					    "grunt-sass": "^1.2.0",
 | 
				
			||||||
    "grunt-sass-lint": "^0.2.0"
 | 
					    "grunt-sass-lint": "^0.2.0"
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,12 @@ module.exports = function (grunt) {
 | 
				
			|||||||
        cwd: "bower_components/",
 | 
					        cwd: "bower_components/",
 | 
				
			||||||
        dest: "build/vendor/"
 | 
					        dest: "build/vendor/"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      config: {
 | 
				
			||||||
 | 
					        src: ["config.json"],
 | 
				
			||||||
 | 
					        expand: true,
 | 
				
			||||||
 | 
					        cwd: ".",
 | 
				
			||||||
 | 
					        dest: "build/"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
      robotoSlab: {
 | 
					      robotoSlab: {
 | 
				
			||||||
        src: ["fonts/*",
 | 
					        src: ["fonts/*",
 | 
				
			||||||
          "roboto-slab-fontface.css"
 | 
					          "roboto-slab-fontface.css"
 | 
				
			||||||
@ -74,6 +80,14 @@ module.exports = function (grunt) {
 | 
				
			|||||||
        dest: "build/index.html"
 | 
					        dest: "build/index.html"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    inlinedata: {
 | 
				
			||||||
 | 
					      injs: {
 | 
				
			||||||
 | 
					        expand: true,
 | 
				
			||||||
 | 
					        cwd: '.',
 | 
				
			||||||
 | 
					        src: ['build/*.html'],
 | 
				
			||||||
 | 
					        ext: '.html'
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "bower-install-simple": {
 | 
					    "bower-install-simple": {
 | 
				
			||||||
      options: {
 | 
					      options: {
 | 
				
			||||||
        directory: "<%=bowerdir%>",
 | 
					        directory: "<%=bowerdir%>",
 | 
				
			||||||
@ -128,5 +142,6 @@ module.exports = function (grunt) {
 | 
				
			|||||||
  grunt.loadNpmTasks("grunt-sass");
 | 
					  grunt.loadNpmTasks("grunt-sass");
 | 
				
			||||||
  grunt.loadNpmTasks("grunt-postcss");
 | 
					  grunt.loadNpmTasks("grunt-postcss");
 | 
				
			||||||
  grunt.loadNpmTasks("grunt-inline");
 | 
					  grunt.loadNpmTasks("grunt-inline");
 | 
				
			||||||
 | 
					  grunt.loadNpmTasks('grunt-inline-data');
 | 
				
			||||||
  grunt.loadNpmTasks("grunt-cache-breaker");
 | 
					  grunt.loadNpmTasks("grunt-cache-breaker");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@ module.exports = function (grunt) {
 | 
				
			|||||||
    watch: {
 | 
					    watch: {
 | 
				
			||||||
      html: {
 | 
					      html: {
 | 
				
			||||||
        files: ["html/index.html"],
 | 
					        files: ["html/index.html"],
 | 
				
			||||||
        tasks: ["copy"]
 | 
					        tasks: ["copy", "inlinedata"]
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      sass: {
 | 
					      sass: {
 | 
				
			||||||
        files: ["scss/**/*.scss"],
 | 
					        files: ["scss/**/*.scss"],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user