-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (33 loc) · 1.06 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const through2 = require('through2');
const browserSync = require('browser-sync').create();
//scss to css
function style() {
return gulp.src('assets/scss/**/*.scss', { sourcemaps: true })
.pipe(sourcemaps.init())
.pipe(sass({
// outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(autoprefixer('last 2 versions'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('assets/css', { sourcemaps: '.' }))
// .pipe(bs.reload({
// stream: true
// }));
}
// Watch function
function watch() {
browserSync.init({
proxy: 'localhost/theme/chatloop-doc/document/index.html'
});
gulp.watch('assets/scss/**/*.scss', style);
gulp.watch('html/*').on('change', browserSync.reload);
gulp.watch('assets/css/*.css').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;
const build = gulp.series(watch);
gulp.task('default', build, 'browser-sync');