forked from devbridge/Vanilla-Autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
49 lines (40 loc) · 1.54 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
var pkg = grunt.file.readJSON('package.json');
var banner = [
'/**',
'* Devbridge Vanilla Autocomplete, version ' + pkg.version,
'* (c) 2015 Tomas Kirda',
'*',
'* Devbridge Vanilla Autocomplete is freely distributable under the terms of an MIT license.',
'* For details visit: https://github.com/devbridge/Vanilla-Autocomplete',
'*/'].join('\n') + '\n';
// Project configuration.
grunt.initConfig({
pkg: pkg,
uglify: {
options: {
banner: banner
},
build: {
src: 'dist/devbridge-vanilla-autocomplete.js',
dest: 'dist/devbridge-vanilla-autocomplete.min.js'
}
}
});
grunt.task.registerTask('build', function() {
var version = pkg.version,
src = banner + grunt.file.read('src/devbridge-autocomplete.js').replace('%version%', version),
filePath = 'dist/devbridge-vanilla-autocomplete.js';
// Update not minimized release version:
console.log('Updating: ' + filePath);
grunt.file.write(filePath, src);
// Minify latest version:
grunt.task.run('uglify');
// Update bower version:
var bowerJson = 'bower.json';
var bower = grunt.file.readJSON(bowerJson);
bower.version = version;
grunt.file.write(bowerJson, JSON.stringify(bower, null, 4));
});
};