1 | /*************************************** |
---|
2 | * This Gruntfile is organized with two phases, |
---|
3 | * compile and build. Compile will lint HTML, |
---|
4 | * JavaScript and compile LESS. The build phase |
---|
5 | * creates an optimized stand-alone build that |
---|
6 | * can be distributed. |
---|
7 | */ |
---|
8 | |
---|
9 | module.exports = function(grunt) { |
---|
10 | |
---|
11 | var buildDir = 'build/'; |
---|
12 | var srcDir = 'src/'; |
---|
13 | |
---|
14 | grunt.initConfig({ |
---|
15 | clean: { |
---|
16 | build: { |
---|
17 | src: [buildDir] |
---|
18 | } |
---|
19 | }, |
---|
20 | coffee: { |
---|
21 | options: { |
---|
22 | bare: true |
---|
23 | }, |
---|
24 | compile: { |
---|
25 | files: [{ |
---|
26 | expand: true, |
---|
27 | cwd: srcDir, |
---|
28 | src: ['client/qed-client/**/*.coffee', 'server/**/*.coffee'], |
---|
29 | dest: buildDir, |
---|
30 | ext: '.js' |
---|
31 | }] |
---|
32 | } |
---|
33 | }, |
---|
34 | copy: { |
---|
35 | compile: { |
---|
36 | files: [{ |
---|
37 | src: [srcDir+'**', '!**/*.coffee' ], |
---|
38 | dest: buildDir |
---|
39 | }] |
---|
40 | } |
---|
41 | }, |
---|
42 | dojo: { |
---|
43 | options: { |
---|
44 | dojo: srcDir+'client/dojo/dojo.js' |
---|
45 | }, |
---|
46 | build: { |
---|
47 | options: { |
---|
48 | profile: srcDir+'client/client.profile.js', |
---|
49 | releaseDir: buildDir |
---|
50 | } |
---|
51 | } |
---|
52 | }, |
---|
53 | htmlhint: { |
---|
54 | options: { |
---|
55 | htmlhintrc: srcDir+".htmlhintrc" |
---|
56 | }, |
---|
57 | compile: { |
---|
58 | files: [{ |
---|
59 | expand: true, |
---|
60 | cwd: srcDir, |
---|
61 | src: ['client/*.html', 'client/qed-client/**/*.html'] |
---|
62 | }] |
---|
63 | } |
---|
64 | }, |
---|
65 | jshint: { |
---|
66 | options: { |
---|
67 | jshintrc: srcDir+".jshintrc" |
---|
68 | }, |
---|
69 | compile: { |
---|
70 | files: [{ |
---|
71 | expand: true, |
---|
72 | cwd: srcDir, |
---|
73 | src: ['client/qed-client/**/*.js', 'server/**.js'] |
---|
74 | }] |
---|
75 | } |
---|
76 | }, |
---|
77 | less: { |
---|
78 | options: { |
---|
79 | strictImports: false, |
---|
80 | dumpLineNumbers: "all" |
---|
81 | }, |
---|
82 | compile: { |
---|
83 | files: [{ |
---|
84 | expand: true, |
---|
85 | cwd: srcDir, |
---|
86 | src: ['client/qed-client/css/qed.less'], |
---|
87 | dest: buildDir, |
---|
88 | ext: '.css' |
---|
89 | }] |
---|
90 | } |
---|
91 | } |
---|
92 | }); |
---|
93 | |
---|
94 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
95 | grunt.loadNpmTasks('grunt-contrib-coffee'); |
---|
96 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
97 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
98 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
99 | grunt.loadNpmTasks('grunt-curl'); |
---|
100 | grunt.loadNpmTasks('grunt-dojo'); |
---|
101 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
102 | grunt.loadNpmTasks('grunt-zip'); |
---|
103 | |
---|
104 | grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile', 'coffee:compile', 'copy:compile']); |
---|
105 | grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build']); |
---|
106 | grunt.registerTask('deploy', []); |
---|
107 | grunt.registerTask('default', ['compile']); |
---|
108 | |
---|
109 | }; |
---|