-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (30 loc) · 988 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
'use strict';
var gulp = require('gulp'); // Load Gulp!
var autoprefixer = require('gulp-autoprefixer');
var historyApiFallback = require('connect-history-api-fallback');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var rename = require('gulp-rename');
gulp.task('scss', function () {
gulp.src('./scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(gulp.dest('./css'))
.pipe(sass({outputStyle: 'compressed'}))
.pipe(rename('main.min.css'))
.pipe(gulp.dest('./build/css'));
});
// create browser
gulp.task('newbrowser', function() {
browserSync.init({
server: {
baseDir: "./",
middleware: [ historyApiFallback() ]
}
});
// make browser reload on change
gulp.watch('./scss/**/*.scss', ['scss']);
gulp.watch(['*.html','js/*.js','css/*.css']).on('change', browserSync.reload);
});