-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
37 lines (30 loc) · 1.07 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
"use strict";
const gulp = require('gulp');
const del = require('del');
const stripComments = require('gulp-strip-comments');
const stripDebug = require('gulp-strip-debug');
function clean() {
return del(['build/**/*']);
}
function processJavascript() {
return gulp
.src(['./src/background.js', './src/sidebar/*.js'], { base: 'src/' })
.pipe(stripComments( { space:false, trim:true } ))
.pipe(stripDebug())
.pipe(gulp.dest('./build/'));
}
function processOtherCode() {
// comments are not stripped from CSS as decomment still has troubles with regular expressions
return gulp
.src(['src/manifest.json', './src/sidebar/*.html', './src/_locales/**'], { base: 'src/' })
.pipe(stripComments())
.pipe(gulp.dest('./build/'));
}
function moveAssets() {
return gulp
.src(['src/icons/**/*.*', 'src/sidebar/*.svg', 'src/sidebar/*.css'], { base: 'src/' })
.pipe(gulp.dest('./build/'))
}
const build = gulp.series(clean, gulp.parallel(processJavascript, processOtherCode, moveAssets));
exports.build = build;
exports.clean = clean;