-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (36 loc) · 962 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
var gulp = require('gulp');
var imageResize = require('gulp-image-resize');
var rename = require('gulp-rename');
var watch = require('gulp-watch');
var babel = require('gulp-babel');
const presets = [
{name: '_1x', width: 340},
{name: '_2x', width: 600}
];
gulp.task('image-resize', function () {
presets.map((preset) => {
gulp.src('./img/*')
.pipe(imageResize({
width: preset.width,
imageMagick: true
}))
.pipe(rename(function (path) {
path.basename += preset.name;
}))
.pipe(gulp.dest('./img/'));
});
});
gulp.task('default', function () {
return gulp.src('./assets/**/*')
.pipe(gulp.dest('.tmp/public/'))
});
gulp.task('compile', function () {
return gulp.src('./assets/sw.js')
.pipe(babel())
.pipe(gulp.dest('.tmp/public'))
});
gulp.task('watch', function () {
return gulp.src('./assets/**/*')
.pipe(watch('./assets/**/*'))
.pipe(gulp.dest('.tmp/public/'))
});