-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (49 loc) · 1.22 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
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
sass = require('gulp-ruby-sass'),
plumber = require('gulp-plumber'),
livereload = require('gulp-livereload'),
imagemin = require('gulp-imagemin'),
prefix = require('gulp-autoprefixer');
// Scripts Task
// Uglifies
gulp.task('scripts', function(){
gulp.src('js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest('minjs'));
});
// Styles Task
// Uglifiesv
gulp.task('styles', function() {
return sass('scss/*.scss', {
style: 'compressed'
})
.pipe(plumber())
.pipe(prefix('last 2 versions'))
.pipe(gulp.dest('css'))
.pipe(livereload());
});
// Image Task
// Compress
gulp.task('image', function() {
gulp.src('img/*')
.pipe(imagemin())
.pipe(gulp.dest('build/img'));
});
//html Task
gulp.task('html', function() {
return gulp.src([
'./index.html'
])
.pipe(livereload());
});
//Watch Task
//Watches JS
gulp.task('watch',function(){
livereload.listen({start: true});
gulp.watch('js/*.js', ['scripts']);
gulp.watch('scss/*.scss', ['styles']);
gulp.watch('./index.html', ['html']);
});
gulp.task('default',['scripts' , 'styles', 'watch']);