Commit cf6180b0da6e0e72ec22639f637b54d3f2e1c461

Authored by Rishav
1 parent 5c6477d3d4
Exists in master

minor change

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
1 'use strict'; 1 'use strict';
2 module.exports = function (grunt) { 2 module.exports = function (grunt) {
3 3
4 // Load grunt tasks automatically 4 // Load grunt tasks automatically
5 require('load-grunt-tasks')(grunt); 5 require('load-grunt-tasks')(grunt);
6 6
7 // Show grunt task time 7 // Show grunt task time
8 require('time-grunt')(grunt); 8 require('time-grunt')(grunt);
9 9
10 // Configurable paths for the app 10 // Configurable paths for the app
11 var appConfig = { 11 var appConfig = {
12 app: 'app', 12 app: 'app',
13 dist: 'dist' 13 dist: 'dist'
14 }; 14 };
15 15
16 // Grunt configuration 16 // Grunt configuration
17 grunt.initConfig({ 17 grunt.initConfig({
18 18
19 // Project settings 19 // Project settings
20 inspinia: appConfig, 20 inspinia: appConfig,
21 21
22 // The grunt server settings 22 // The grunt server settings
23 connect: { 23 connect: {
24 options: { 24 options: {
25 port: 9000, 25 port: 9000,
26 hostname: 'localhost', 26 hostname: '0.0.0.0',
27 livereload: 35729 27 livereload: 35729
28 }, 28 },
29 livereload: { 29 livereload: {
30 options: { 30 options: {
31 open: true, 31 open: true,
32 middleware: function (connect) { 32 middleware: function (connect) {
33 return [ 33 return [
34 connect.static('.tmp'), 34 connect.static('.tmp'),
35 connect().use( 35 connect().use(
36 '/bower_components', 36 '/bower_components',
37 connect.static('./bower_components') 37 connect.static('./bower_components')
38 ), 38 ),
39 connect.static(appConfig.app) 39 connect.static(appConfig.app)
40 ]; 40 ];
41 } 41 }
42 } 42 }
43 }, 43 },
44 dist: { 44 dist: {
45 options: { 45 options: {
46 open: true, 46 open: true,
47 base: '<%= inspinia.dist %>' 47 base: '<%= inspinia.dist %>'
48 } 48 }
49 } 49 }
50 }, 50 },
51 // Compile less to css 51 // Compile less to css
52 less: { 52 less: {
53 development: { 53 development: {
54 options: { 54 options: {
55 compress: true, 55 compress: true,
56 optimization: 2 56 optimization: 2
57 }, 57 },
58 files: { 58 files: {
59 "app/styles/style.css": "app/less/style.less" 59 "app/styles/style.css": "app/less/style.less"
60 } 60 }
61 } 61 }
62 }, 62 },
63 // Watch for changes in live edit 63 // Watch for changes in live edit
64 watch: { 64 watch: {
65 styles: { 65 styles: {
66 files: ['app/less/**/*.less'], 66 files: ['app/less/**/*.less'],
67 tasks: ['less', 'copy:styles'], 67 tasks: ['less', 'copy:styles'],
68 options: { 68 options: {
69 nospawn: true, 69 nospawn: true,
70 livereload: '<%= connect.options.livereload %>' 70 livereload: '<%= connect.options.livereload %>'
71 }, 71 },
72 }, 72 },
73 js: { 73 js: {
74 files: ['<%= inspinia.app %>/scripts/{,*/}*.js'], 74 files: ['<%= inspinia.app %>/scripts/{,*/}*.js'],
75 options: { 75 options: {
76 livereload: '<%= connect.options.livereload %>' 76 livereload: '<%= connect.options.livereload %>'
77 } 77 }
78 }, 78 },
79 livereload: { 79 livereload: {
80 options: { 80 options: {
81 livereload: '<%= connect.options.livereload %>' 81 livereload: '<%= connect.options.livereload %>'
82 }, 82 },
83 files: [ 83 files: [
84 '<%= inspinia.app %>/**/*.html', 84 '<%= inspinia.app %>/**/*.html',
85 '.tmp/styles/{,*/}*.css', 85 '.tmp/styles/{,*/}*.css',
86 '<%= inspinia.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' 86 '<%= inspinia.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
87 ] 87 ]
88 } 88 }
89 }, 89 },
90 // If you want to turn on uglify you will need write your angular code with string-injection based syntax 90 // If you want to turn on uglify you will need write your angular code with string-injection based syntax
91 // For example this is normal syntax: function exampleCtrl ($scope, $rootScope, $location, $http){} 91 // For example this is normal syntax: function exampleCtrl ($scope, $rootScope, $location, $http){}
92 // And string-injection based syntax is: ['$scope', '$rootScope', '$location', '$http', function exampleCtrl ($scope, $rootScope, $location, $http){}] 92 // And string-injection based syntax is: ['$scope', '$rootScope', '$location', '$http', function exampleCtrl ($scope, $rootScope, $location, $http){}]
93 uglify: { 93 uglify: {
94 options: { 94 options: {
95 mangle: false 95 mangle: false
96 } 96 }
97 }, 97 },
98 // Clean dist folder 98 // Clean dist folder
99 clean: { 99 clean: {
100 dist: { 100 dist: {
101 files: [{ 101 files: [{
102 dot: true, 102 dot: true,
103 src: [ 103 src: [
104 '.tmp', 104 '.tmp',
105 '<%= inspinia.dist %>/{,*/}*', 105 '<%= inspinia.dist %>/{,*/}*',
106 '!<%= inspinia.dist %>/.git*' 106 '!<%= inspinia.dist %>/.git*'
107 ] 107 ]
108 }] 108 }]
109 }, 109 },
110 server: '.tmp' 110 server: '.tmp'
111 }, 111 },
112 // Copies remaining files to places other tasks can use 112 // Copies remaining files to places other tasks can use
113 copy: { 113 copy: {
114 dist: { 114 dist: {
115 files: [ 115 files: [
116 { 116 {
117 expand: true, 117 expand: true,
118 dot: true, 118 dot: true,
119 cwd: '<%= inspinia.app %>', 119 cwd: '<%= inspinia.app %>',
120 dest: '<%= inspinia.dist %>', 120 dest: '<%= inspinia.dist %>',
121 src: [ 121 src: [
122 '*.{ico,png,txt}', 122 '*.{ico,png,txt}',
123 '.htaccess', 123 '.htaccess',
124 '*.html', 124 '*.html',
125 'views/{,*/}*.html', 125 'views/{,*/}*.html',
126 'styles/patterns/*.*', 126 'styles/patterns/*.*',
127 'img/{,*/}*.*' 127 'img/{,*/}*.*'
128 ] 128 ]
129 }, 129 },
130 { 130 {
131 expand: true, 131 expand: true,
132 dot: true, 132 dot: true,
133 cwd: 'bower_components/fontawesome', 133 cwd: 'bower_components/fontawesome',
134 src: ['fonts/*.*'], 134 src: ['fonts/*.*'],
135 dest: '<%= inspinia.dist %>' 135 dest: '<%= inspinia.dist %>'
136 }, 136 },
137 { 137 {
138 expand: true, 138 expand: true,
139 dot: true, 139 dot: true,
140 cwd: 'bower_components/bootstrap', 140 cwd: 'bower_components/bootstrap',
141 src: ['fonts/*.*'], 141 src: ['fonts/*.*'],
142 dest: '<%= inspinia.dist %>' 142 dest: '<%= inspinia.dist %>'
143 }, 143 },
144 ] 144 ]
145 }, 145 },
146 styles: { 146 styles: {
147 expand: true, 147 expand: true,
148 cwd: '<%= inspinia.app %>/styles', 148 cwd: '<%= inspinia.app %>/styles',
149 dest: '.tmp/styles/', 149 dest: '.tmp/styles/',
150 src: '{,*/}*.css' 150 src: '{,*/}*.css'
151 } 151 }
152 }, 152 },
153 // Renames files for browser caching purposes 153 // Renames files for browser caching purposes
154 filerev: { 154 filerev: {
155 dist: { 155 dist: {
156 src: [ 156 src: [
157 '<%= inspinia.dist %>/scripts/{,*/}*.js', 157 '<%= inspinia.dist %>/scripts/{,*/}*.js',
158 '<%= inspinia.dist %>/styles/{,*/}*.css', 158 '<%= inspinia.dist %>/styles/{,*/}*.css',
159 '<%= inspinia.dist %>/styles/fonts/*' 159 '<%= inspinia.dist %>/styles/fonts/*'
160 ] 160 ]
161 } 161 }
162 }, 162 },
163 htmlmin: { 163 htmlmin: {
164 dist: { 164 dist: {
165 options: { 165 options: {
166 collapseWhitespace: true, 166 collapseWhitespace: true,
167 conservativeCollapse: true, 167 conservativeCollapse: true,
168 collapseBooleanAttributes: true, 168 collapseBooleanAttributes: true,
169 removeCommentsFromCDATA: true, 169 removeCommentsFromCDATA: true,
170 removeOptionalTags: true 170 removeOptionalTags: true
171 }, 171 },
172 files: [{ 172 files: [{
173 expand: true, 173 expand: true,
174 cwd: '<%= inspinia.dist %>', 174 cwd: '<%= inspinia.dist %>',
175 src: ['*.html', 'views/{,*/}*.html'], 175 src: ['*.html', 'views/{,*/}*.html'],
176 dest: '<%= inspinia.dist %>' 176 dest: '<%= inspinia.dist %>'
177 }] 177 }]
178 } 178 }
179 }, 179 },
180 useminPrepare: { 180 useminPrepare: {
181 html: 'app/index.html', 181 html: 'app/index.html',
182 options: { 182 options: {
183 dest: 'dist' 183 dest: 'dist'
184 } 184 }
185 }, 185 },
186 usemin: { 186 usemin: {
187 html: ['dist/index.html'] 187 html: ['dist/index.html']
188 } 188 }
189 }); 189 });
190 190
191 // Run live version of app 191 // Run live version of app
192 grunt.registerTask('live', [ 192 grunt.registerTask('live', [
193 'clean:server', 193 'clean:server',
194 'copy:styles', 194 'copy:styles',
195 'connect:livereload', 195 'connect:livereload',
196 'watch' 196 'watch'
197 ]); 197 ]);
198 198
199 // Run build version of app 199 // Run build version of app
200 grunt.registerTask('server', [ 200 grunt.registerTask('server', [
201 'build', 201 'build',
202 'connect:dist:keepalive' 202 'connect:dist:keepalive'
203 ]); 203 ]);
204 204
205 // Build version for production 205 // Build version for production
206 grunt.registerTask('build', [ 206 grunt.registerTask('build', [
207 'clean:dist', 207 'clean:dist',
208 'less', 208 'less',
209 'useminPrepare', 209 'useminPrepare',
210 'concat', 210 'concat',
211 'copy:dist', 211 'copy:dist',
212 'cssmin', 212 'cssmin',
213 'uglify', 213 'uglify',
214 'filerev', 214 'filerev',
215 'usemin', 215 'usemin',
216 'htmlmin' 216 'htmlmin'
217 ]); 217 ]);
218 218
219 }; 219 };
220 220