17f21fd1 by Adam Heath

Starting to fill iout basic dynamic grunt config.

1 parent c7a40343
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
11 "node": ">=0.8.0" 11 "node": ">=0.8.0"
12 }, 12 },
13 "dependencies": { 13 "dependencies": {
14 "grunt": "~0" 14 "grunt": "~0",
15 "grunt-contrib-csslint": "~0",
16 "grunt-contrib-jshint": "~0",
17 "grunt-contrib-htmlmin": "~0",
18 "lodash": "~2"
15 }, 19 },
16 "devDependencies": { 20 "devDependencies": {
17 "grunt": "~0"
18 } 21 }
19 } 22 }
......
...@@ -6,4 +6,61 @@ ...@@ -6,4 +6,61 @@
6 'use strict'; 6 'use strict';
7 7
8 module.exports = function (grunt) { 8 module.exports = function (grunt) {
9 var _ = require('lodash');
10 function createConfig(mpConfig) {
11
12 var initConfig = {};
13 var checkList = [];
14
15 if (mpConfig.jshint) {
16 grunt.loadNpmTasks('grunt-contrib-jshint');
17 initConfig.jshint = {
18 options: mpConfig.jshint.options,
19 all: [
20 'Gruntfile.js',
21 ],
22 main: {
23 options: _.extend({}, mpConfig.jshint.browserOptions, {
24 globals: {
25 define: false,
26 require: false,
27 },
28 }),
29 files: {
30 src: [
31 'src/scripts/main.js',
32 ],
33 },
34 }
35 };
36 checkList.push('jshint');
37 }
38
39 if (mpConfig.csslint) {
40 grunt.loadNpmTasks('grunt-contrib-csslint');
41 initConfig.csslint = {
42 };
43 checkList.push('csslint');
44 }
45
46 if (mpConfig.htmlmin) {
47 grunt.loadNpmTasks('grunt-contrib-htmlmin');
48 initConfig.htmlmin = {
49 };
50 checkList.push('htmlmin');
51 }
52
53 grunt.initConfig(initConfig);
54
55 grunt.registerTask('check', checkList);
56
57 grunt.registerTask('default', [
58 'check',
59 ]);
60
61 }
62
63 return {
64 createConfig: createConfig,
65 };
9 }; 66 };
......