-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
41 lines (32 loc) · 1.2 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
const autoprefixer = require('gulp-autoprefixer')
const del = require('del')
const gulp = require('gulp')
const runSequence = require('run-sequence')
const zip = require('gulp-zip')
const temp = 'temp-wrapper-folder'
const paths = {
styles: ['css/*.css'],
indexScripts: ['node_modules/jquery/dist/jquery.js', 'js/index.js'],
destination: 'dist',
}
gulp.task('css', () =>
gulp
.src(paths.styles)
.pipe(autoprefixer({ browsers: ['last 10 Chrome versions', 'last 10 Firefox versions'] }))
.pipe(gulp.dest(paths.destination))
)
gulp.task('scripts', () => gulp.src(paths.indexScripts).pipe(gulp.dest(paths.destination)))
gulp.task('wrap', () => gulp.src(['dist/**']).pipe(gulp.dest(`${temp}/dist`)))
gulp.task('zip', () =>
gulp
.src([`${temp}/**/*`, 'manifest.json'])
.pipe(zip('upload-me-to-the-browser-web-stores.zip'))
.pipe(gulp.dest('.'))
)
gulp.task('clean', () => del([`${temp}/**`]))
gulp.task('watch', () => {
gulp.watch(paths.indexScripts, ['scripts'])
gulp.watch(paths.styles, ['css'])
})
gulp.task('default', ['scripts', 'css', 'watch'])
gulp.task('prod', callback => runSequence(['scripts', 'css'], 'wrap', 'zip', 'clean', callback))