-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
31 lines (25 loc) · 903 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
const gulp = require('gulp'),
zip = require('gulp-zip'),
rename = require('gulp-rename'),
clean = require('gulp-clean');
const extensionName = 'trello-card-id';
gulp.task('default', ['firefox', 'chrome']);
// firefox
gulp.task('firefox', buildExtension.bind(null, 'firefox', 'xpi'));
// chrome, edge and opera
gulp.task('chrome', buildExtension.bind(null, 'chrome', 'zip'));
function buildExtension(type, ext) {
return gulp.src([`manifest.${type}.json`, 'images/icon*.png', 'style.css', 'script.js'], {base: './'})
.pipe(rename(path => {
if (path.basename == `manifest.${type}`) {
path.basename = 'manifest';
}
}))
.pipe(zip(`${extensionName}.${type}.${ext}`))
.pipe(gulp.dest('dist'));
}
// remove
gulp.task('clean', function () {
return gulp.src('dist', {read: false})
.pipe(clean());
});