forked from hflabs/suggestions-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
126 lines (115 loc) · 3.57 KB
/
Gruntfile.js
File metadata and controls
126 lines (115 loc) · 3.57 KB
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
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: [
'/**',
' <%= pkg.description %>, version <%= pkg.version %>',
'',
' <%= pkg.description %> is freely distributable under the terms of MIT-style license',
' Built on DevBridge Autocomplete for jQuery (https://github.com/devbridge/jQuery-Autocomplete)',
' For details, see <%= pkg.homepage %>',
'/\n'].join('\n *'),
lineending: {
options: {
eol: 'lf',
overwrite: true
},
src: {
files: [{
expand: true,
cwd: 'src/',
src: '**/*.js'
}]
},
tests: {
files: [{
expand: true,
cwd: 'test/specs',
src: '*.js'
}]
},
dist: {
files: [{
expand: true,
cwd: 'dist/',
src: '**/*.js'
}]
}
},
includes: {
options: {
banner: '<%= banner %>',
includePath: 'src/includes/',
includeRegexp: /^\/\/include\s+"(\S+)"\s*$/
},
files: {
expand: true,
cwd: 'src/',
src: '*.js',
dest: 'dist/js/'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
jsmin: {
options: {
mangle: true,
beautify: false
},
files: [{
expand: true,
cwd: 'dist/js/',
src: ['*.js', '!*.min.js'],
dest: 'dist/js/',
rename: function (dest, src) {
return dest + src.replace(/.js$/, '.min.js');
}
}]
}
},
jasmine: {
options: {
specs: 'test/specs/*.js',
helpers: 'test/helpers/*.js',
vendor: 'test/vendor/*.js',
styles: 'dist/css/*.css',
outfile: 'test/runner.html',
keepRunner: true
},
js: {
src: 'dist/js/jquery.suggestions.js'
},
jsmin: {
src: 'dist/js/jquery.suggestions.min.js'
}
},
less: {
js: {
expand: true,
cwd: 'less/',
src: '*.less',
dest: 'dist/css/',
ext: '.css'
}
},
sed: {
version: {
path: ['dist/js/'],
pattern: '%VERSION%',
recursive: true,
replacement: '<%= pkg.version %>'
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-includes');
grunt.loadNpmTasks('grunt-sed');
grunt.loadNpmTasks('grunt-lineending');
grunt.registerTask('test', ['jasmine:js', 'jasmine:jsmin']);
grunt.registerTask('build', ['lineending:src', 'lineending:tests', 'less', 'includes', 'uglify:jsmin', 'sed:version', 'lineending:dist']);
grunt.registerTask('default', ['build', 'test']);
};