|
| 1 | +module.exports = function( grunt ) { |
| 2 | + 'use strict'; |
| 3 | + // |
| 4 | + // Grunt configuration: |
| 5 | + // |
| 6 | + // https://github.com/cowboy/grunt/blob/master/docs/getting_started.md |
| 7 | + // |
| 8 | + grunt.initConfig({ |
| 9 | + |
| 10 | + // Project configuration |
| 11 | + // --------------------- |
| 12 | + |
| 13 | + // specify an alternate install location for Bower |
| 14 | + bower: { |
| 15 | + dir: 'app/scripts/vendor' |
| 16 | + }, |
| 17 | + |
| 18 | + // Coffee to JS compilation |
| 19 | + coffee: { |
| 20 | + dist: { |
| 21 | + src: 'app/scripts/**/*.coffee', |
| 22 | + dest: 'app/scripts' |
| 23 | + } |
| 24 | + }, |
| 25 | + |
| 26 | + // compile .scss/.sass to .css using Compass |
| 27 | + compass: { |
| 28 | + dist: { |
| 29 | + // http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties |
| 30 | + options: { |
| 31 | + css_dir: 'temp/styles', |
| 32 | + sass_dir: 'app/styles', |
| 33 | + images_dir: 'app/images', |
| 34 | + javascripts_dir: 'temp/scripts', |
| 35 | + force: true |
| 36 | + } |
| 37 | + } |
| 38 | + }, |
| 39 | + |
| 40 | + // generate application cache manifest |
| 41 | + manifest:{ |
| 42 | + dest: '' |
| 43 | + }, |
| 44 | + |
| 45 | + // headless testing through PhantomJS |
| 46 | + jasmine: { |
| 47 | + all: ['test/**/*.html'] |
| 48 | + }, |
| 49 | + |
| 50 | + // default watch configuration |
| 51 | + watch: { |
| 52 | + coffee: { |
| 53 | + files: '<config:coffee.dist.src>', |
| 54 | + tasks: 'coffee reload' |
| 55 | + }, |
| 56 | + compass: { |
| 57 | + files: [ |
| 58 | + 'app/styles/**/*.{scss,sass}' |
| 59 | + ], |
| 60 | + tasks: 'compass reload' |
| 61 | + }, |
| 62 | + reload: { |
| 63 | + files: [ |
| 64 | + 'app/*.html', |
| 65 | + 'app/styles/**/*.css', |
| 66 | + 'app/scripts/**/*.js', |
| 67 | + 'app/images/**/*' |
| 68 | + ], |
| 69 | + tasks: 'reload' |
| 70 | + } |
| 71 | + }, |
| 72 | + |
| 73 | + // default lint configuration, change this to match your setup: |
| 74 | + // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task |
| 75 | + lint: { |
| 76 | + files: [ |
| 77 | + 'Gruntfile.js', |
| 78 | + 'app/scripts/**/*.js', |
| 79 | + 'spec/**/*.js' |
| 80 | + ] |
| 81 | + }, |
| 82 | + |
| 83 | + // specifying JSHint options and globals |
| 84 | + // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals |
| 85 | + jshint: { |
| 86 | + options: { |
| 87 | + curly: true, |
| 88 | + eqeqeq: true, |
| 89 | + immed: true, |
| 90 | + latedef: true, |
| 91 | + newcap: true, |
| 92 | + noarg: true, |
| 93 | + sub: true, |
| 94 | + undef: true, |
| 95 | + boss: true, |
| 96 | + eqnull: true, |
| 97 | + browser: true |
| 98 | + }, |
| 99 | + globals: { |
| 100 | + jQuery: true |
| 101 | + } |
| 102 | + }, |
| 103 | + |
| 104 | + // Build configuration |
| 105 | + // ------------------- |
| 106 | + |
| 107 | + // the staging directory used during the process |
| 108 | + staging: 'temp', |
| 109 | + // final build output |
| 110 | + output: 'dist', |
| 111 | + |
| 112 | + mkdirs: { |
| 113 | + staging: 'app/' |
| 114 | + }, |
| 115 | + |
| 116 | + // Below, all paths are relative to the staging directory, which is a copy |
| 117 | + // of the app/ directory. Any .gitignore, .ignore and .buildignore file |
| 118 | + // that might appear in the app/ tree are used to ignore these values |
| 119 | + // during the copy process. |
| 120 | + |
| 121 | + // concat css/**/*.css files, inline @import, output a single minified css |
| 122 | + css: { |
| 123 | + 'styles/main.css': ['styles/**/*.css'] |
| 124 | + }, |
| 125 | + |
| 126 | + // renames JS/CSS to prepend a hash of their contents for easier |
| 127 | + // versioning |
| 128 | + rev: { |
| 129 | + js: 'scripts/**/*.js', |
| 130 | + css: 'styles/**/*.css', |
| 131 | + img: 'images/**' |
| 132 | + }, |
| 133 | + |
| 134 | + // usemin handler should point to the file containing |
| 135 | + // the usemin blocks to be parsed |
| 136 | + 'usemin-handler': { |
| 137 | + html: 'index.html' |
| 138 | + }, |
| 139 | + |
| 140 | + // update references in HTML/CSS to revved files |
| 141 | + usemin: { |
| 142 | + html: ['**/*.html'], |
| 143 | + css: ['**/*.css'] |
| 144 | + }, |
| 145 | + |
| 146 | + // HTML minification |
| 147 | + html: { |
| 148 | + files: ['**/*.html'] |
| 149 | + }, |
| 150 | + |
| 151 | + // Optimizes JPGs and PNGs (with jpegtran & optipng) |
| 152 | + img: { |
| 153 | + dist: '<config:rev.img>' |
| 154 | + }, |
| 155 | + |
| 156 | + // rjs configuration. You don't necessarily need to specify the typical |
| 157 | + // `path` configuration, the rjs task will parse these values from your |
| 158 | + // main module, using http://requirejs.org/docs/optimization.html#mainConfigFile |
| 159 | + // |
| 160 | + // name / out / mainConfig file should be used. You can let it blank if |
| 161 | + // you're using usemin-handler to parse rjs config from markup (default |
| 162 | + // setup) |
| 163 | + rjs: { |
| 164 | + // no minification, is done by the min task |
| 165 | + optimize: 'none', |
| 166 | + baseUrl: './scripts', |
| 167 | + wrap: true, |
| 168 | + name: 'main' |
| 169 | + }, |
| 170 | + |
| 171 | + // While Yeoman handles concat/min when using |
| 172 | + // usemin blocks, you can still use them manually |
| 173 | + concat: { |
| 174 | + dist: '' |
| 175 | + }, |
| 176 | + |
| 177 | + min: { |
| 178 | + dist: '' |
| 179 | + } |
| 180 | + }); |
| 181 | + |
| 182 | + // Alias the `test` task to run the `mocha` task instead |
| 183 | + grunt.registerTask('test', 'jasmine'); |
| 184 | + |
| 185 | +}; |
0 commit comments