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 | var fs = require('fs'); |
---|
9 | var path = require('path'); |
---|
10 | |
---|
11 | module.exports = function(grunt) { |
---|
12 | |
---|
13 | var buildDir = '../build/'; |
---|
14 | |
---|
15 | grunt.initConfig({ |
---|
16 | copy: { |
---|
17 | build: { |
---|
18 | files: [ |
---|
19 | {src: ['client/*.html'], dest: buildDir}, |
---|
20 | {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, |
---|
21 | {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, |
---|
22 | ] |
---|
23 | } |
---|
24 | }, |
---|
25 | dojo: { |
---|
26 | options: { |
---|
27 | dojo: 'client/dojo/dojo.js', |
---|
28 | }, |
---|
29 | build: { |
---|
30 | options: { |
---|
31 | profile: 'client/client.profile.js' |
---|
32 | } |
---|
33 | } |
---|
34 | }, |
---|
35 | htmlhint: { |
---|
36 | options: { |
---|
37 | htmlhintrc: ".htmlhintrc" |
---|
38 | }, |
---|
39 | compile: { |
---|
40 | files: { |
---|
41 | src: ['client/*.html', 'client/qed-client/**.html'] |
---|
42 | } |
---|
43 | } |
---|
44 | }, |
---|
45 | jshint: { |
---|
46 | options: { |
---|
47 | jshintrc: ".jshintrc" |
---|
48 | }, |
---|
49 | compile: { |
---|
50 | files: { |
---|
51 | src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**'] |
---|
52 | } |
---|
53 | } |
---|
54 | }, |
---|
55 | less: { |
---|
56 | options: { |
---|
57 | strictImports: false, |
---|
58 | dumpLineNumbers: "all" |
---|
59 | }, |
---|
60 | compile: { |
---|
61 | files: { |
---|
62 | 'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less' |
---|
63 | } |
---|
64 | } |
---|
65 | } |
---|
66 | }); |
---|
67 | |
---|
68 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
69 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
70 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
71 | grunt.loadNpmTasks('grunt-dojo'); |
---|
72 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
73 | |
---|
74 | grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']); |
---|
75 | grunt.registerTask('build', ['compile', 'dojo:build', 'copy:build']); |
---|
76 | grunt.registerTask('default', ['compile']); |
---|
77 | |
---|
78 | }; |
---|