-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
63 lines (58 loc) · 1.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var browserify = require('browserify');
var vueify = require('vueify');
var source = require('vinyl-source-stream');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var imageResize = require('gulp-image-resize');
var rename = require('gulp-rename');
gulp.task('stylus', function () {
gulp.src('./resources/stylus/site.styl')
.pipe(stylus())
.pipe(gulp.dest('./sitefront/static/sitefront/css'));
});
gulp.task('script', function() {
browserify('./resources/js/app.js')
.transform(vueify)
.bundle()
.pipe(source('app.bundled.js'))
.pipe(gulp.dest('./sitefront/static/sitefront/js'));
});
gulp.task('watch', function() {
gulp.watch('./resources/stylus/**/*.styl', ['stylus']);
gulp.watch('./resources/js/**/*', ['script']);
});
gulp.task('image', function() {
return gulp.src('./resources/images/*.jpg')
.pipe(imageResize({
width : 1200,
crop : false,
upscale : false,
ImageMagick: true
}))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(rename({suffix: "-md"}))
.pipe(gulp.dest('./sitefront/static/sitefront/images'))
.pipe(imageResize({
width : 800,
crop : false,
upscale : false,
ImageMagick: true
}))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(rename(function (path) {
var l = path.basename.length - 3;
path.basename = path.basename.substr(0, l);
path.basename += "-sm";
}))
.pipe(gulp.dest('./sitefront/static/sitefront/images'));
});