-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (46 loc) · 1.48 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
var gulp = require('gulp');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var templateCache = require('gulp-angular-templatecache');
var streamqueue = require('streamqueue');
var fs = require('fs');
var cleanCSS = require('gulp-clean-css');
gulp.task('default', ['minify','minify-css', 'connect', 'watch']);
gulp.task('connect', function () {
connect.server({
root: ['demo', './'],
livereload: true,
});
});
gulp.task('reload', ['minify'], function () {
gulp.src('./dist/**/*.*').pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./src/**', './demo/**'], ['reload']);
});
gulp.task('minify-css', () => {
return gulp.src('src/templates/*.css')
.pipe(concat('asf-cloudinary-file-upload.css'))
.pipe(gulp.dest('./dist'))
.pipe(concat('asf-cloudinary-file-upload.min.css'))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('./dist'));
});
gulp.task('minify', function () {
var files = JSON.parse(fs.readFileSync('sources.json', 'utf-8'));
var stream = streamqueue({ objectMode: true },
gulp.src(['src/templates/**/*.html']).pipe(templateCache({
standalone: true,
root: 'src/templates/',
})),
gulp.src(files)
)
.pipe(concat('asf-cloudinary-file-upload.js'))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename('asf-cloudinary-file-upload.min.js'))
.pipe(gulp.dest('./dist'));
return stream;
});