forked from frapontillo/angular-bootstrap-switch
/
Gruntfile.js
101 lines (94 loc) · 2.49 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
// Generated on 2013-07-30 using generator-angular 0.3.1
'use strict';
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
src: 'src',
dist: 'dist',
example: 'example'
};
try {
yeomanConfig.src = require('./bower.json').appPath || yeomanConfig.src;
} catch (e) {}
grunt.initConfig({
yeoman: yeomanConfig,
pkg: grunt.file.readJSON('bower.json'),
meta: {
banner: '/**\n' + ' * <%= pkg.name %>\n' +
' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @author <%= pkg.author.name %> (<%= pkg.author.email %>)\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license <%= _.pluck(pkg.licenses, "type").join(", ") %>\n**/\n\n'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.src %>/{,*/}*.js'
]
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
},
travis: {
configFile: 'karma.conf.js',
browsers: ['PhantomJS'],
singleRun: true
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
}
},
ngmin: {
dist: {
src: ['src/**/*.js'],
dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
}
},
concat: {
options: {
banner: '<%= meta.banner %>'
},
// Prepends everything with a banner
dist: {
src: '<%= ngmin.dist.dest %>',
dest: '<%= ngmin.dist.dest %>'
}
},
uglify: {
options: {
banner: '<%= meta.banner %>'
},
min: {
files: {
'<%= yeoman.dist %>/<%= pkg.name %>.min.js': '<%= ngmin.dist.dest %>'
}
}
}
});
// Test the directive
grunt.registerTask('test', ['jshint', 'karma:unit']);
grunt.registerTask('test-travis', ['jshint', 'karma:travis']);
// Build the directive
// - clean:dist: cleans the output directory
// - ngmin: prepares the angular files into a single one
// - concat: adds a banner to the debug file
// - uglify: adds a banner to the minified file
grunt.registerTask('build', ['clean:dist', 'ngmin', 'concat', 'uglify']);
// Default task, do everything
grunt.registerTask('default', ['test-travis', 'build']);
};