This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Gulpfile.js
62 lines (55 loc) · 1.54 KB
/
Gulpfile.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
var gulp = require('gulp'),
rimraf = require('rimraf'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
ngmin = require('gulp-ngmin'),
useref = require('gulp-useref'),
deploy = require('gulp-gh-pages'),
gif = require('gulp-if'),
es = require('event-stream'),
lr = require('gulp-refresh'),
autoprefixer = require('gulp-autoprefixer'),
saveLicense = require('uglify-save-license');
// Clean public
gulp.task('clean', function (cb) {
rimraf('dist', cb);
});
// Build
gulp.task('default', ['build', 'assets']);
gulp.task('dev', ['default', 'watch']);
gulp.task('watch', function(){
gulp.watch('src/**/*', ['build', 'assets']);
});
gulp.task('build', ['clean'], function () {
var nonVendor = 'scripts/**/*.js';
var assets = useref.assets();
return gulp.src('src/index.html')
.pipe(assets)
.pipe(gif(nonVendor, ngmin()))
/*.pipe(gif('*.js', uglify({
mangle: false,
preserveComments: saveLicense
})))*/
.pipe(gif('*.css', autoprefixer('last 2 versions')))
.pipe(gif('*.css', minifyCss()))
.pipe(assets.restore())
.pipe(useref())
.pipe(gulp.dest('dist'))
.pipe(lr());
});
gulp.task('assets', ['clean'], function () {
return gulp.src([
'src/blackList.json',
'src/favicon.ico',
'src/logo.svg',
'src/opensearch.xml',
'src/README.md'
], {base: 'src'})
.pipe(gulp.dest('dist'))
.pipe(lr());
});
// Deploy
gulp.task('deploy', ['default'], function () {
return gulp.src('dist/**/*')
.pipe(deploy('[email protected]:gulpjs/plugins.git'));
});