-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
111 lines (99 loc) · 1.94 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
/*global module */
module.exports = function( grunt ) {
// var pkg = grunt.file.readJSON( 'package.json' );
// config
grunt.initConfig({
// local web server
connect: {
options: {
base: './'
},
testserver: {
options: {
port: 9999
}
}
},
// code qa
eslint: {
app: { src: 'src/*.js' },
tests: { src: 'test/*.js' },
build: { src: 'Gruntfile.js' }
},
// acceptance tests
casper: {
acceptance: {
options: {
test: true,
concise: true
},
files: {
'log/casper-acceptance.xml' : [ 'test/*spec.js' ]
}
}
},
// build
uglify: {
js: {
options: {
sourceMap: true
},
files: {
'dist/quick-exit.min.js': [ 'src/quick-exit.js' ]
}
}
},
sass: {
src: {
options: {
sourceComments: true,
outputStyle: 'expanded',
indentType: 'tab',
indentWidth: 1,
linefeed: 'crlf'
},
files: {
'src/quick-exit.css': 'src/quick-exit.scss'
}
},
dist: {
options: {
outputStyle: 'compressed',
linefeed: 'crlf'
},
files: {
'dist/quick-exit.min.css': 'src/quick-exit.scss'
}
}
},
// watch
watch: {
options: {
spawn: false
},
sass: {
files: 'src/*.scss',
tasks: [ 'sass:src' ]
},
js: {
files: 'src/*.js',
tasks: [ 'eslint:app', 'casper:acceptance' ]
},
tests: {
files: 'test/**',
tasks: [ 'eslint:tests', 'casper:acceptance' ]
}
}
});
// plugins
grunt.loadNpmTasks( 'grunt-casper' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-sass' );
// helpers
grunt.registerTask( 'test', [ 'eslint', 'connect:testserver', 'casper' ]);
grunt.registerTask( 'build', [ 'sass:src', 'test', 'uglify', 'sass:dist' ]);
grunt.registerTask( 'default', [ 'sass:src', 'test', 'watch' ]);
};