-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathGruntfile.js
93 lines (88 loc) · 2.03 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
/*
by Nic Mulvaney
*/
module.exports = function (grunt) {
// Folder settings
var SOURCE = 'source/'
var BUILD = 'lib/'
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// JSHint
jshint: {
files: [SOURCE + 'score.js'],
options: {
laxcomma: true,
boss: true,
curly: true,
eqeqeq: true,
eqnull: true,
es3: true,
browser: true,
smarttabs: true,
'-W099': true, // Relax rules on mixed tabs and spaces
asi: true, // Tolerates Automatic Semicolon Insertion
laxbreak: true, // Tolerates unsafe line breaks
globals: {
jQuery: true
}
}
},
// Concatatenated Javascript
concat: {
options: {
process: true
},
main: {
src: [SOURCE + 'score.js', SOURCE + '_defaults.js'],
dest: BUILD + 'score.js'
},
basic: {
src: [SOURCE + 'score.js'],
dest: BUILD + 'score-basic.js'
}
},
// Minified Javascript
uglify: {
options: {
banner:
'/*! score.js ~ (c) 2014 Nic Mulvaney */\n' +
'/*! Compiled @ <%= grunt.template.today("yyyy-mm-dd HH:MM") %> */\n',
mangle: true
},
main: {
src: BUILD + 'score.js',
dest: BUILD + 'score.min.js'
},
basic: {
src: BUILD + 'score-basic.js',
dest: BUILD + 'score-basic.min.js'
}
},
// Watch files and build when they change
watch: {
js: {
files: [SOURCE + 'score.js'],
tasks: ['build']
}
},
notify_hooks: {
options: {
enabled: true,
max_jshint_notifications: 2,
title: 'Oops!'
}
}
})
// Load grunt different tasks
require('load-grunt-tasks')(grunt)
grunt.task.run('notify_hooks')
grunt.registerTask('build', [
'jshint',
'concat:main',
'concat:basic',
'uglify:main',
'uglify:basic'
])
// Register grunt tasks
grunt.registerTask('default', ['build', 'watch:js', 'notify:watch'])
}