-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
188 lines (188 loc) · 6.74 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/**
* Created by Kemal on 07/31/15.
*/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
dev: {
options: {
port: 9023,
livereload: true,
debug: true,
target: 'http://localhost:9023/index.html', // target url to open
open: true
}
},
test: {
options: {
port: 9023,
keepalive: false
}
}
},
jshint: {
beforeconcat: ["gruntfile.js", "app/**/*.js"]
},
concat: {
app: {
src: ['src/app/app.js',
'src/app/core/*.js',
'src/app/directives/*.js',
'src/app/tests/*.js'
],
dest: 'dev/js/watg-angular-richtext.js'
},
appdist: {
src: ['src/app/appdist.js', 'src/app/directives/watgRichtextEditorDirective.js'
],
dest: 'dist/js/watg-angular-richtext.js'
},
vendor: {
src: [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angular/angular.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-route/angular-route.js'
],
dest: 'dev/js/vendor.js'
},
vendorDist: {
src: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/angular-route/angular-route.min.js'
],
dest: 'dev/js/watg-angular-richtext-vendor-dependencies.min.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
mangle: false
},
app: {
files: {
'dev/js/watg-angular-richtext.min.js': ['dev/js/watg-angular-richtext.js']
}
},
appdist: {
files: {
'dist/js/watg-angular-richtext.min.js': ['dist/js/watg-angular-richtext.js']
}
}
},
less: {
dev: {
options: {
paths: ["assets/css"]
},
files: {
"src/assets/watg-angular-richtext.css": "src/assets/watg-angular-richtext.less"
}
}
},
concat_css: {
assets: {
src: ["src/assets/watg-angular-richtext.css"],
dest: "dev/css/watg-angular-richtext.css"
},
assetsdist: {
src: ["src/assets/watg-angular-richtext.css"],
dest: "dist/css/watg-angular-richtext.css"
}
},
cssmin: {
options: {
keepSpecialComments: 0
},
assets: {
files: {
'dev/css/watg-angular-richtext.min.css': ['dev/css/watg-angular-richtext.css']
}
},
assetsdist: {
files: {
'dist/css/watg-angular-richtext.min.css': ['dist/css/watg-angular-richtext.css']
}
},
vendor: {
files: {
'dev/css/vendor.css': [
'bower_components/bootstrap/dist/css/bootstrap.css',
'bower_components/fontawesome/css/font-awesome.css'
]
}
}
},
watch: {
files: ["src/app/app.js", "src/app/core/*.js", "src/app/**/*.js", "src/assets/*.less"],
tasks: ['concat:app', 'uglify', 'less', 'concat_css', 'cssmin']
},
copy: {
dev: {
files: [{
expand: true,
src: ['bower_components/fontawesome/fonts/*', 'bower_components/bootstrap/fonts/*'],
dest: 'dev/fonts/',
filter: 'isFile',
flatten: true
}, {
expand: true,
src: ['bower_components/footable/css/fonts/*'],
dest: 'dev/css/fonts/',
filter: 'isFile',
flatten: true
}]
},
dist: {
files: [
{
expand: true,
src: ["src/assets/images/*"],
dest: 'dist/css/images/',
filter: 'isFile',
flatten: true
}
]
}
},
html2js: {
options: {
base: 'src',
module: 'watgRichtext.templates',
singleModule: true,
useStrict: true,
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
dist: {
src: ['src/app/directives/templates/*.html'],
dest: 'dist/js/watg-angular-richtext.tpl.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.registerTask('dev', ["jshint", 'concat:app', 'uglify', 'less', 'concat_css', 'cssmin', 'copy', 'connect:dev', 'watch']);
grunt.registerTask('dist', ['concat:appdist', 'concat:vendorDist', 'uglify:appdist', 'concat_css:assetsdist', 'cssmin:assetsdist', 'copy:dist', 'html2js:dist']);
};