-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
70 lines (59 loc) · 1.78 KB
/
gulpfile.js
File metadata and controls
70 lines (59 loc) · 1.78 KB
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
64
65
66
67
68
69
70
const gulp = require('gulp');
const csso = require('gulp-csso');
const rev = require('gulp-rev');
const uglify = require('gulp-uglify-es').default;
const imagemin = require('gulp-imagemin');
const del = require('del');
const path=require('path');
const manifestCWD = path.join(__dirname, "public", "assets");
const manifestPath = path.join(manifestCWD, "rev-manifest.json");
gulp.task('css',function(){
console.log('minifying css...');
return gulp.src('./assets/**/*.css')
.pipe(csso())
.pipe(rev())
.pipe(gulp.dest('./public/assets'))
.pipe(rev.manifest(manifestPath, {
cwd: manifestCWD,
merge: true
}))
.pipe(gulp.dest('./public/assets'));
});
gulp.task('js',function(){
console.log('minifying js...');
return gulp.src('./assets/**/*.js')
.pipe(uglify())
.pipe(rev())
.pipe(gulp.dest('./public/assets'))
.pipe(rev.manifest(manifestPath, {
cwd: manifestCWD,
merge: true
}))
.pipe(gulp.dest('./public/assets'));
});
gulp.task('images',function(){
console.log('compressing images...');
return gulp.src('./assets/**/*.+(png|jpg|gif|svg|jpeg)')
.pipe(imagemin())
.pipe(rev())
.pipe(gulp.dest('./public/assets'))
.pipe(rev.manifest(manifestPath, {
cwd: manifestCWD,
merge: true
}))
.pipe(gulp.dest('./public/assets'));
});
gulp.task('files',function(){
console.log('Files');
return gulp.src('./assets/**/*.csv')
.pipe(gulp.dest('./public/assets'))
})
// empty the public/assets directory
gulp.task('clean:assets', function(done){
del.sync('./public/assets');
done();
});
gulp.task('build', gulp.series('clean:assets', 'css', 'images','js','files'), function(done){
console.log('Building assets');
done();
});