-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
37 lines (28 loc) · 984 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
const {series=()=>{}, src=()=>{}, dest=()=>{}} = require("gulp");
const clean = require("gulp-clean");
function cleanCache() {
return src("lib", {read: false, allowEmpty: true}).pipe(clean());
}
function compileSass() {
const postcss = require("gulp-postcss");
const syntax = require("postcss-less");
const sass = require('gulp-sass');
return src("src/components/**/*.sass")
.pipe(
sass()
)
.pipe(postcss([require("autoprefixer")], {syntax: syntax}))
.pipe(dest("lib/"));
}
function complie() {
const babel = require('gulp-babel');
const replace = require('gulp-replace');
return src(['src/components/**/*.js', 'src/components/**/*.jsx', '!src/components/**/*.test.js'])
.pipe(babel({
presets: ['@babel/env', '@babel/react']
}))
.pipe(replace('.sass', '.css'))
.pipe(dest('lib/'))
}
exports.default = series(cleanCache,
series(compileSass, complie));