This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Gruntfile.js
96 lines (89 loc) · 2.81 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
var ngAnnotate = require("ng-annotate");
grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
npmpkg: grunt.file.readJSON('package.json'),
meta: {
banner: '/**\n' +
' * <%= pkg.description %>\n' +
' * @version v<%= npmpkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @author <%= pkg.authors.join(", ") %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
' */\n'
},
bower: {
install: {}
},
concat: {
options: {
//banner: '<%= meta.banner %>\n(function(angular, undefined) {\n\'use strict\';\n',
banner: '<%= meta.banner %>\n',
footer: '',
process: function(src, filepath) {
var res = ngAnnotate(src, {
add: true,
});
if (res.errors) {
// do something with this, res.errors is now an array of strings
throw new Error(res.errors.join("\n"));
} else {
return res.src;
}
}
},
dist: {
files: {
'dist/<%= pkg.name %>.js': [
'src/**/*.js'
],
'dist/<%= pkg.name %>-bundle.js': [
'bower_components/deep-diff/releases/deep-diff-0.2.0.min.js',
'bower_components/uri-templates/uri-templates.js',
'src/**/*.js'
]
}
}
},
uglify: {
options: {
mangle: true,
banner: '<%= meta.banner %>'
},
dist: {
files: {
'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js',
'dist/<%= pkg.name %>-bundle.min.js': 'dist/<%= pkg.name %>-bundle.js'
}
}
},
karma: {
dev: {
configFile: 'test/karma.conf.js',
singleRun: false,
autoWatch: true,
browsers: ['Chrome'],
reporters: ['mocha']
},
ie: {
configFile: 'test/karma.conf-ci.js',
singleRun: true,
autoWatch: false,
browsers: ['IE'],
reporters: ['mocha']
},
ci: {
configFile: 'test/karma.conf-ci.js',
singleRun: true,
autoWatch: false,
browsers: ['PhantomJS'],
reporters: ['mocha']
}
}
});
grunt.registerTask('build', ['concat', 'uglify']);
return grunt;
};