-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
80 lines (66 loc) · 1.67 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//gulpfile on Sun 10 Jan(01) 2016
//Author: Rohan M.
// Load PLUGIN
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minify = require('gulp-minify-css'),
//jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
//rename = require('gulp-rename'),
conc = require('gulp-concat'),
//notify = require('gulp-notify'),
//cache = require('gulp-cache'),
browserSync = require('browser-sync').create(),
//del = require('del'),
plumber = require('gulp-plumber');
//JS
gulp.task('scripts', function(){
gulp.src('app/js/**/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(minify())
//.pipe(conc())
.pipe(gulp.dest('app/scripts/'))
.pipe(browserSync.reload({stream:true}));
})
//CSS
gulp.task('styles',function(){
gulp.src('app/scss/**/*.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 versions'))
.pipe(minify())
.pipe(gulp.dest('app/styles/'))
.pipe(browserSync.reload({stream:true}));
})
//IMG
gulp.task('images',function(){
gulp.src('app/img/**/*')
.pipe(plumber())
.pipe(imagemin())
.pipe(gulp.dest('app/images'));
})
//HTML
gulp.task('html',function(){
gulp.src('app/**/*.html')
.pipe(browserSync.reload({stream:true}));
})
//WATCH
gulp.task('watch', function(){
gulp.watch('app/js/**/*.js', ['scripts']);
gulp.watch('app/scss/**/*.scss', ['styles']);
gulp.watch('app/img/**/*', ['images']);
gulp.watch('app/*.html', ['html'])
});
//RELOAD PAGE
gulp.task('live',function(){
browserSync.init({
server:{
baseDir: "app"
}
})
})
//default
gulp.task('default', ['scripts','styles','live','images','html','watch']);