-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
49 lines (40 loc) · 973 Bytes
/
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
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const zip = require('gulp-zip');
const del = require('del');
const version = '3.0.0';
/**
* Serve: gulp serve
*/
gulp.task('serve', function(){
gulp.watch('**').on('change', () => {
browserSync.reload();
});
browserSync.init({
server: ["./"]
});
});
/**
* Export extension: gulp export
*/
const files = [
'assets/**/*.*',
'index.html',
'manifest.json'
]
// move files to temp folder
gulp.task('dist', () => {
return gulp.src(files, {base: './'})
.pipe(gulp.dest('dist'))
});
// zip temp folder
gulp.task('zip', () => {
return gulp.src(['dist/**/*.*'], {base: './'})
.pipe(zip(`lipsum-extension-${version}.zip`))
.pipe(gulp.dest('extension'));
});
// delete temp folder
gulp.task('clean', function(){
return del('dist', {force: true});
});
gulp.task('export', gulp.series('dist', 'zip', 'clean'));