-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
126 lines (105 loc) · 3.37 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
'use strict';
module.exports = function (grunt) {
var dependencies = [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js'
],
projectFiles = [
'src/js/number-spinner.directive.js'
],
testDependencies = [
'bower_components/jquery/dist/jquery.js'
],
testFiles = [
'test/*.js'
],
templates = [
'template/*.html'
];
grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
jshint: {
files: projectFiles.concat(testFiles),
options: grunt.file.readJSON('.jshintrc')
},
watch: {
jsfiles: {
files: projectFiles.concat(testFiles).concat(templates),
tasks: ['jshint', 'karma']
},
changables: {
files: ['src/**', 'test/**', 'demo/**/**'],
options: {
livereload: true
}
}
},
connect: {
server: {
options: {
port: 3000,
base: ['.', 'demo', 'template', 'bower_components', 'src']
}
}
},
karma: {
unit: {
options: {
configFile: 'karma.conf.js',
files: testDependencies.concat(dependencies).concat(templates)
.concat(projectFiles).concat(testFiles),
preprocessors: {
'src/js/*.js': ['coverage'],
'template/*.html': ['ng-html2js']
}
}
}
},
uglify: {
dist: {
files: {
'dist/ui-number-spinner.min.js': projectFiles
}
}
},
concat: {
options: {
stripBanners: true,
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> \n' +
'Source Code: https://github.com/halilb/angular-number-spinner */ \n\n'
},
dist: {
src: ['src/js/*.js', 'template/templates.js'],
dest: 'dist/angular-number-spinner.js'
}
},
html2js: {
dist: {
options: {
base: '.',
module: 'number-spinner-template'
},
src: ['template/*.html'],
dest: 'template/templates.js'
}
},
clean: {
dist: {
src: ['template/templates.js']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('test', ['jshint', 'karma']);
grunt.registerTask('build', ['uglify']);
grunt.registerTask('dist', ['html2js:dist', 'concat:dist', 'clean:dist']);
grunt.registerTask('default', ['connect', 'watch']);
};