forked from Esri/bayview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
146 lines (129 loc) · 3.68 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
/* global module */
module.exports = function(grunt) {
'use strict';
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Project configuration
grunt.initConfig({
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Code Quality Tasks
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
files: {
// Run JSHint on all JS files in the /app folder (ignore /libs for now)
src: ['app/**/*.js']
}
},
jscs: {
options: {
config: '.jscsrc',
esnext: false,
verbose: true
},
files: {
// Run JSHint on all JS files in the /app folder (ignore /libs for now)
src: ['app/**/*.js']
}
},
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dependency Management Tasks
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shell: {
bowerInstall: {
command: 'bower install'
}
},
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Sass/CSS Tasks
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sass: {
dev: {
options: {
// Generate a sourcemap to assist with debugging
sourceMap: true,
outputStyle: 'expanded',
sourceComments: true
},
files: {
'app/css/main.css': 'app/sass/main.scss'
}
},
prod: {
options: {
// Generate a sourcemap to assist with debugging
sourceMap: true,
outputStyle: 'compressed'
},
files: {
'app/css/main.css': 'app/sass/main.scss'
}
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer-core')
]
},
dev: {
src: 'app/css/main.css'
},
prod: {
options: {
processors: [
require('cssnano')({
sourcemap: true
})
]
},
src: 'app/css/main.css'
}
},
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Serve Tasks
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
connect: {
server: {
options: {
hostname: '*',
port: 9001,
livereload: 35729,
open: {
target: 'http://127.0.0.1:9001'
}
}
}
},
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Watch Tasks
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
watch: {
sass: {
// When any .scss files in app/sass/ are modified...
files: ['**/*.scss'],
// Run the sass task
tasks: ['sass:dev', 'postcss:dev']
},
livereload: {
options: {
livereload: 35729
},
files: ['index.html', 'app/**/*.{js,css}']
}
}
// End of Task Config
});
// Task Registration
// Default task
grunt.registerTask('default', ['shell:bowerInstall', 'jshint']);
// Custom tasks
grunt.registerTask('init', 'Run this task to perform any setup necessary.', ['shell:bowerInstall', 'sass:dev', 'postcss:dev']);
grunt.registerTask('serve', 'Spin up a server and open the app in a browser.', ['sass:dev', 'connect', 'watch']);
grunt.registerTask('test', 'Run tests, right now this is just running jshint.', ['jshint', 'jscs']);
grunt.registerTask('build', 'Execute build steps.', ['init', 'jshint', 'sass:prod', 'postcss:prod']);
};