-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
33 lines (28 loc) · 902 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
'use strict';
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
cssmin = require('gulp-cssmin');
// CSS COMPRESS
gulp.task('compress-css', function () {
return gulp.src('css/src/*.css')
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('css'));
});
// JS COMPRESS
gulp.task('compress-js', function () {
return gulp.src('js/src/*.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('js'));
});
gulp.task('compress-css:watch', function () {
gulp.watch('./css/src/*.css', gulp.parallel('compress-css'));
});
gulp.task('compress-js:watch', function () {
gulp.watch('./js/src/*.js', gulp.parallel('compress-js'));
});