-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
131 lines (109 loc) · 3.21 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
/* global module */
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
// Metadata
pkg: grunt.file.readJSON('package.json'),
// -- Tasks
clean: {
dist: [
'dist/css/jquery-tubular.min.css',
'dist/js/jquery-tubular.min.js'
]
}, // clean
recess: {
minified: {
options: {
compress: true
},
files: {
'dist/css/jquery-tubular.min.css': [
'src/less/jquery-tubular.less'
]
}
} // minified
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'src/js/*.js',
'!dist/js/*.min.js'
]
},
uglify: {
minified: {
options: {
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>' +
'* by <%= pkg.author %> (http://monkeymonk.be)' +
'* forked from Sean McCambridge (http://www.seanmccambridge.com/tubular)' + '* licensed under the MIT License '+
'*/'
},
files: {
'dist/js/jquery-tubular.min.js': [
'src/js/jquery-tubular.js'
]
}
}, // minified
}, // uglify
shell: {
done: {
command: 'terminal-notifier -message "Bazinga! Grunt Tasks done!" -title "Gruntfile.js"'
}
}, // shell
connect: {
server: {
options: {
port: 8800,
base: '.'
}
}
}, // connect
watch: {
less: {
files: [
'src/less/*.less'
],
tasks: ['recess', 'shell:done']
},
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['jshint', 'uglify', 'shell:done']
}
}, // watch
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-shell');
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
// -- Tasks
grunt.registerTask('before-test', [
'clean'
]);
grunt.registerTask('test', [
'recess',
'uglify'
]);
grunt.registerTask('after-test', [
'shell:done'
]);
grunt.registerTask('js', [
'uglify',
'shell:done'
]);
grunt.registerTask('css', [
'recess',
'shell:done'
]);
grunt.registerTask('default', ['before-test', 'test', 'after-test']);
};