[453] | 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 | */ |
---|
[443] | 8 | |
---|
| 9 | module.exports = function(grunt) { |
---|
| 10 | |
---|
[463] | 11 | var buildDir = 'build/'; |
---|
| 12 | var srcDir = 'src/'; |
---|
[453] | 13 | |
---|
[443] | 14 | grunt.initConfig({ |
---|
[458] | 15 | clean: { |
---|
[462] | 16 | build: { |
---|
[463] | 17 | src: [buildDir] |
---|
[462] | 18 | } |
---|
[458] | 19 | }, |
---|
[463] | 20 | coffee: { |
---|
| 21 | options: { |
---|
| 22 | bare: true |
---|
[458] | 23 | }, |
---|
[463] | 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 | }] |
---|
[453] | 32 | } |
---|
| 33 | }, |
---|
[463] | 34 | copy: { |
---|
| 35 | compile: { |
---|
| 36 | files: [{ |
---|
| 37 | src: [srcDir+'**', '!**/*.coffee' ], |
---|
| 38 | dest: buildDir |
---|
| 39 | }] |
---|
[458] | 40 | } |
---|
| 41 | }, |
---|
[453] | 42 | dojo: { |
---|
[443] | 43 | options: { |
---|
[463] | 44 | dojo: srcDir+'client/dojo/dojo.js' |
---|
[443] | 45 | }, |
---|
[453] | 46 | build: { |
---|
| 47 | options: { |
---|
[463] | 48 | profile: srcDir+'client/client.profile.js', |
---|
| 49 | releaseDir: buildDir |
---|
[453] | 50 | } |
---|
| 51 | } |
---|
| 52 | }, |
---|
| 53 | htmlhint: { |
---|
| 54 | options: { |
---|
[463] | 55 | htmlhintrc: srcDir+".htmlhintrc" |
---|
[453] | 56 | }, |
---|
| 57 | compile: { |
---|
[463] | 58 | files: [{ |
---|
| 59 | expand: true, |
---|
| 60 | cwd: srcDir, |
---|
| 61 | src: ['client/*.html', 'client/qed-client/**/*.html'] |
---|
| 62 | }] |
---|
[443] | 63 | } |
---|
| 64 | }, |
---|
| 65 | jshint: { |
---|
| 66 | options: { |
---|
[463] | 67 | jshintrc: srcDir+".jshintrc" |
---|
[443] | 68 | }, |
---|
[453] | 69 | compile: { |
---|
[463] | 70 | files: [{ |
---|
| 71 | expand: true, |
---|
| 72 | cwd: srcDir, |
---|
| 73 | src: ['client/qed-client/**/*.js', 'server/**.js'] |
---|
| 74 | }] |
---|
[443] | 75 | } |
---|
| 76 | }, |
---|
[453] | 77 | less: { |
---|
[443] | 78 | options: { |
---|
[453] | 79 | strictImports: false, |
---|
| 80 | dumpLineNumbers: "all" |
---|
[443] | 81 | }, |
---|
[453] | 82 | compile: { |
---|
[463] | 83 | files: [{ |
---|
| 84 | expand: true, |
---|
| 85 | cwd: srcDir, |
---|
| 86 | src: ['client/qed-client/css/qed.less'], |
---|
| 87 | dest: buildDir, |
---|
| 88 | ext: '.css' |
---|
| 89 | }] |
---|
[443] | 90 | } |
---|
| 91 | } |
---|
| 92 | }); |
---|
| 93 | |
---|
[458] | 94 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
[463] | 95 | grunt.loadNpmTasks('grunt-contrib-coffee'); |
---|
[453] | 96 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
| 97 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
[443] | 98 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
[458] | 99 | grunt.loadNpmTasks('grunt-curl'); |
---|
[453] | 100 | grunt.loadNpmTasks('grunt-dojo'); |
---|
[443] | 101 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
[458] | 102 | grunt.loadNpmTasks('grunt-zip'); |
---|
[443] | 103 | |
---|
[463] | 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', []); |
---|
[453] | 107 | grunt.registerTask('default', ['compile']); |
---|
| 108 | |
---|
[443] | 109 | }; |
---|