-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (39 loc) · 1.02 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
let gulp = require('gulp'),
sass = require("gulp-sass")(require('sass')),
postcss = require('gulp-postcss'),
csscomb = require('gulp-csscomb'),
autoprefixer = require('autoprefixer'),
browserSync = require('browser-sync').create();
const paths = {
scss: {
src: 'scss/**/*.scss',
dest: 'css',
watch: 'scss/**/*.scss'
},
js: { }
};
// Compile sass into CSS & auto-inject into browsers.
function compile () {
var sassOptions = {
outputStyle: 'expanded',
indented: true,
indentType: 'space',
indentWidth: 2,
linefeed: 'lf',
sourceMap: false
};
return gulp.src([paths.scss.src])
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(postcss([autoprefixer()]))
.pipe(csscomb())
.pipe(gulp.dest(paths.scss.dest))
.pipe(browserSync.stream());
}
// Watching scss files.
function watch () {
gulp.watch([paths.scss.watch], compile);
}
const build = gulp.series(compile, gulp.parallel(watch));
exports.compile = compile;
exports.watch = watch;
exports.default = build;