-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.3 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var rename = require('gulp-rename');
var cssmin = require('gulp-minify-css');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var plumber = require('gulp-plumber');
gulp.task('scss', function() {
return gulp.src('scss/main.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer({browsers: ['last 2 versions']}))
.pipe(cssmin())
.pipe(rename({ suffix: '.min' }))
.pipe(reload({stream:true}))
.pipe(gulp.dest('./css'));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: './'
},
open: false
});
});
gulp.task('js', function() {
gulp.src('js/app.js')
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(reload({stream:true}))
.pipe(gulp.dest('./js'));
});
gulp.task('html', function() {
gulp.src('./*.html')
.pipe(gulp.dest('./'))
.pipe(reload({stream:true}));
});
gulp.task('watch', function() {
gulp.watch('scss/**/*.scss', ['scss']);
gulp.watch('js/*.js', ['js']);
gulp.watch('./*.html', ['html']);
});
gulp.task('default', ['browser-sync', 'js', 'scss', 'watch']);