-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (49 loc) · 1.52 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var imageop = require('gulp-image-optimization');
const imagemin = require('gulp-imagemin');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
gulp.task('default', ['sass','imagemin', 'css', 'scripts']);
gulp.task('sass', function () {
return gulp.src('./sass/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./public/css'));
});
gulp.task('watch', function () {
gulp.watch('./sass/*.scss', ['sass']);
});
gulp.task('images', function(cb) {
gulp.src('./public/img/*').pipe(imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
})).pipe(gulp.dest('./public/img')).on('end', cb).on('error', cb);
});
gulp.task('imagemin', () =>
gulp.src('./public/img/*.jpg')
.pipe(imagemin())
.pipe(gulp.dest('./public/img'))
);
var jsFiles = './public/js/*.js',
jsDest = './public/js',
cssFiles = './public/css/*.css;'
cssDest = './public/css;'
gulp.task('scripts', function() {
return gulp.src(jsFiles)
.pipe(concat('scripts.js'))
.pipe(gulp.dest(jsDest))
.pipe(rename('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(jsDest));
});
gulp.task('css', function(){
gulp.src(cssFiles)
.pipe(concat('style.css'))
.pipe(gulp.dest(cssDest))
.pipe(rename('style.min.css'))
.pipe(minifyCSS())
.pipe(gulp.dest(cssDest))
});