This repository has been archived by the owner on Feb 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
164 lines (145 loc) · 5.54 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
// JS TASKS ================================================================
// check all js files for errors
jshint: {
all: ['public/javascripts/**/*.js']
},
// take all the js files and minify them into app.min.js
uglify: {
build: {
files: {
'public/js/app.min.js': [
'public/components/angular/angular.min.js',
'public/components/angular-animate/angular-animate.min.js',
'public/components/angular-aria/angular-aria.min.js',
'public/components/angular-messages/angular-messages.min.js',
'public/components/angular-resource/angular-resource.min.js',
'public/components/angular-material/angular-material.min.js',
'public/components/angular-material-data-table/dist/md-data-table.min.js',
'public/components/angular-ui-router/release/angular-ui-router.min.js',
'public/javascripts/**/*.js',
'public/javascripts/*.js'
]
}
}
},
// CSS TASKS ===============================================================
// preprocess CSS files using SASS
sass: {
build: {
files: {
'public/stylesheets/style.css': 'public/stylesheets/style.css.scss'
}
}
},
// take the processed style.css file and minify
cssmin: {
build: {
files: {
'public/css/app.min.css': [
'public/components/angular-material/angular-material.min.css',
'public/components/angular-material-data-table/dist/md-data-table.min.css',
'public/stylesheets/**/*.css',
'public/stylesheets/*.css'
]
}
}
},
// OTHER TASKS ==============================================================
// include all javascript and css files on index.html
includeSource: {
options: {
basePath: 'public',
templates: {
html: {
js: '<script type="text/javascript" src="{filePath}"></script>',
css: '<link rel="stylesheet" type="text/css" href="{filePath}" />',
}
}
},
dist: {
files: {
'public/app.html': 'public/app.tpl.html'
}
}
},
// watch css and js files and process the above tasks
watch: {
css: {
files: ['public/stylesheets/**/*.scss'],
tasks: ['sass']
},
js: {
files: ['public/javascripts/**/*.js'],
tasks: ['jshint']
},
all: {
files: ['public/javascripts/**/*.js', 'public/app.tpl.html'],
tasks: ['includeSource']
}
},
// watch our node server for changes
nodemon: {
dev: {
script: 'server.js'
}
},
// run watch and nodemon at the same time
concurrent: {
options: {
logConcurrentOutput: true
},
tasks: ['nodemon', 'watch']
},
// TEST TASKS ==============================================================
// run site unit tests
karma: {
unit: {
configFile: 'karma.conf.js'
},
continuous: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
},
},
// run site e2e tests
protractor: {
options: {
// Location of your protractor config file
configFile: 'protractor.conf.js',
// Do you want the output to use fun colors?
noColor: false,
// Set to true if you would like to use the Protractor command line debugging tool
// debug: true,
// Additional arguments that are passed to the webdriver command
args: { }
},
e2e: {
options: {
// Stops Grunt process if a test fails
keepAlive: false
}
},
continuous: {
options: {
keepAlive: true
}
}
},
});
grunt.loadNpmTasks('grunt-include-source');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-karma');
// grunt.loadNpmTasks('grunt-protractor-runner');
grunt.registerTask('build', ['jshint', 'uglify', 'sass', 'cssmin', 'includeSource']);
grunt.registerTask('dev', ['sass', 'jshint', 'includeSource', 'concurrent']);
};