-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
42 lines (39 loc) · 1009 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
40
41
42
const { src, dest, watch } = require('gulp'),
sass = require('gulp-sass')(require('sass')),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
browserSync = require('browser-sync').create();
const PORT = 3000;
// server
function server(cb) {
browserSync.init({
server: {
baseDir: './'
},
port: PORT,
files: [
'./static/{img,css,js}/*',
'./components/**/*',
'./router/**/*',
'./store/**/*',
'./vender/*',
'./views/**/*',
'./app.js',
'./config.js',
'./index.html'
],
watch: false
});
watch(['./static/scss/*.scss'], buildSass);
}
// sass
function buildSass() {
return src('./static/scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write('./'))
.pipe(dest('./static/css'))
.pipe(browserSync.stream({ match: '**/*.css' }));
}
exports.default = server;