forked from Daniel-KM/Omeka-S-module-Ebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (36 loc) · 1.13 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
'use strict';
const del = require('del');
const gulp = require('gulp');
const gulpif = require('gulp-if');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const lec = require('gulp-line-ending-corrector');
const filter = require('gulp-filter');
const bundle = [
{
'source': 'node_modules/epubjs-reader/reader/**',
'dest': 'asset/vendor/epubjs-reader',
},
];
gulp.task('clean', function(done) {
bundle.forEach(function (module) {
return del.sync(module.dest);
});
done();
});
gulp.task('sync', function (done) {
const filtering = filter(['**/*.html', '**/*.js', '**/*.css'], {restore: true});
bundle.forEach(function (module) {
gulp.src(module.source)
.pipe(filtering)
.pipe(lec())
.pipe(filtering.restore)
.pipe(gulpif(module.rename, rename({suffix:'.min'})))
.pipe(gulpif(module.uglify, uglify()))
.pipe(gulp.dest(module.dest));
});
done();
});
gulp.task('default', gulp.series('clean', 'sync'));
gulp.task('install', gulp.task('default'));
gulp.task('update', gulp.task('default'));