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