forked from stevermeister/ngWig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
145 lines (139 loc) · 3.8 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var srcPath = './src',
distPath = './dist';
grunt.initConfig({
srcPath: srcPath,
distPath: distPath,
copy: {
dist: {
files: [
{src: srcPath + '/css/ng-wig.css', dest: distPath + '/css/ng-wig.css'},
{expand: true, cwd: srcPath + '/javascript/app/', src: [
'plugins/clear-styles.ngWig.js',
'plugins/forecolor.ngWig.js',
'plugins/formats.ngWig.js'
], dest: distPath}
]
}
},
ngAnnotate: {
app1: {
files: {
'<%= distPath %>/ng-wig.js': [
srcPath + '/javascript/app/ng-wig/ng-wig.js',
srcPath + '/javascript/app/ng-wig/ng-wig.component.js',
srcPath + '/javascript/app/ng-wig/ng-wig-toolbar.provider.js',
srcPath + '/javascript/app/ng-wig/ng-wig-plugin-adapter.component.js',
srcPath + '/javascript/app/templates.js'
]
}
},
plugins: {
files: [{
expand: true,
cwd: srcPath + '/javascript/app/plugins/',
src: [
'clear-styles.ngWig.js',
'forecolor.ngWig.js',
'formats.ngWig.js'
],
dest: distPath + '/plugins'
}]
}
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'dist/ng-wig.js': [ distPath +'/ng-wig.js']
}
},
plugins: {
files: [{
expand: true,
cwd: distPath + '/plugins/',
src: ['*.js'],
dest: distPath + '/plugins'
}]
}
},
uglify: {
build: {
files: {
'dist/ng-wig.min.js': [ distPath +'/ng-wig.js']
}
},
plugins: {
files: [{
expand: true,
cwd: distPath + '/plugins/',
src: [
'clear-styles.ngWig.js',
'forecolor.ngWig.js',
'formats.ngWig.js'
],
dest: distPath + '/plugins',
ext: ['.ngWig.min.js']
}]
}
},
cssmin: {
build: {
files: {
'dist/css/ng-wig.min.css': [ distPath +'/css/ng-wig.css']
}
}
},
clean:{
bower: ['bower_components'],
target: ['dist/**']
},
html2js: {
options: {
base: srcPath + '/javascript/app/',
module: 'ngwig-app-templates'
},
main: {
src: [ srcPath + '/javascript/app/ng-wig/views/*.html'],
dest: srcPath + '/javascript/app/templates.js'
}
},
watch: {
templates: {
files:['src/javascript/app/**/views/**/*.html'],
tasks: ['html2js']
}
},
bump: {
options: {
files: ['package.json', 'bower.json', 'dist/ng-wig.js', 'src/javascript/app/ng-wig/ng-wig.js'],
commitFiles: ['package.json', 'bower.json', 'dist/**', 'src/javascript/app/ng-wig/ng-wig.js'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
autoWatch: false,
singleRun: true
},
continuous: {
configFile: 'karma.conf.js'
}
}
});
grunt.registerTask('default', ['start']);
grunt.registerTask('start', ['html2js', 'watch']);
grunt.registerTask('install', ['copy:dev', 'clean:bower', 'html2js']);
grunt.registerTask('build', ['html2js', 'copy:dist', 'ngAnnotate', 'babel', 'uglify', 'cssmin', 'bump:patch']);
grunt.registerTask('devBuild', ['html2js', 'copy:dist', 'ngAnnotate', 'babel', 'uglify', 'cssmin']);
grunt.registerTask('upversion', ['bump:minor']);
//grunt.registerTask('upversion', ['bump:major']);
};