forked from frapontillo/angular-filters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
109 lines (103 loc) · 2.6 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
'use strict';
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
src: 'src',
dist: 'dist',
test: 'test'
};
grunt.initConfig({
yeoman: yeomanConfig,
pkg: grunt.file.readJSON('package.json'),
dev: {
reporters: 'dots'
},
karma : {
options: {
configFile: 'karma.conf.js',
singleRun: true
},
travis: {
browsers: ['PhantomJS']
},
local: {
browsers: ['Chrome']
},
dev: {
singleRun: false
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
src: [
'Gruntfile.js',
'<%= yeoman.src %>/**/*.js'
],
test: {
src: ['<%= yeoman.test %>/**/*.js'],
options: {
jshintrc: 'test/.jshintrc'
}
}
},
meta: {
banner: '/**\n' + ' * <%= pkg.description %>\n' +
' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @author <%= pkg.author.name %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license <%= _.pluck(pkg.licenses, "type").join(", ") %>\n**/\n\n'
},
clean: {
dist: {
files: [{
dot: true,
src: [
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
temp: {
src: ['<%= yeoman.dist %>/.temp']
}
},
ngmin: {
dist: {
expand: true,
cwd: '<%= yeoman.src %>',
src: ['**/*.js'],
dest: '<%= yeoman.dist %>/.temp'
}
},
concat: {
options: {
banner: '<%= meta.banner %>\'use strict\';\n',
process: function(src, filepath) {
return '// Source: ' + filepath + '\n' +
src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
}
},
build: {
src: ['common/*.js', '<%= yeoman.dist %>/.temp/**/*.js'],
dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '<%= meta.banner %>'
},
build: {
src: ['<%= yeoman.dist %>/<%= pkg.name %>.js'],
dest: '<%= yeoman.dist %>/<%= pkg.name %>.min.js'
}
}
});
grunt.registerTask('test', ['jshint', 'karma:local']);
grunt.registerTask('test-travis', ['jshint', 'karma:travis']);
grunt.registerTask('build', ['clean', 'ngmin', 'concat', 'uglify', 'clean:temp']);
grunt.registerTask('travis', ['test-travis', 'build']);
grunt.registerTask('default', ['test-travis', 'build']);
};