-
Notifications
You must be signed in to change notification settings - Fork 21
/
gulpfile.js
49 lines (43 loc) · 1020 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
42
43
44
45
46
47
48
49
// Packages
var gulp = require("gulp"),
sass = require("gulp-ruby-sass"),
imagemin = require("gulp-imagemin"),
del = require("del");
var fd = {
styles: ['dev/sass/', 'assets/style/']
}
// Sass Task
gulp.task('compile-sass', function(){
return gulp.src(fd.styles[0] + '**/*.scss')
.pipe(sass({
style: "compressed",
noCache: true
})).on('error', function(err) {
console.log(err.message);
})
.pipe(gulp.dest(fd.styles[1]))
});
// Images Task
gulp.task('imagemin', function(){
return gulp.src('dev/images/*')
.pipe(imagemin({
optimizationLevel: 7,
progressive: true,
interlaced: true
}))
.pipe(gulp.dest('assets/images'))
});
// Clean Task
gulp.task('clean', function(cb) {
del(['assets/style', 'assets/images'], cb)
});
gulp.task('default', ['clean'], function(){
gulp.start('compile-sass', 'imagemin')
});
// Gulp Watch
gulp.task('watch', function(){
gulp.watch('dev/sass/*.scss', ['compile-sass']);
gulp.watch('dev/images', ['imagemin']);
})
// Exports
module.exports = gulp;