-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (36 loc) · 1.15 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
const gulp = require('gulp');
const { src, dest } = gulp;
// Import Gulp plugins.
const babel = require('gulp-babel');
const plumber = require('gulp-plumber');
const less = require('gulp-less');
const clean = require('gulp-rimraf');
//clear dist folder
gulp.task('clean', function () {
return gulp.src('./dist/*', { read: false })
.pipe(plumber())
.pipe(clean());
});
// Copy all styles to dist folder
gulp.task('copy-styles', function () {
return gulp.src('./src/styles/**/*.less')
.pipe(plumber())
.pipe(gulp.dest('./dist/styles'));
});
// Convert all less files to css
gulp.task('lesscss', function () {
return gulp.src('./dist/styles/**/*.less')
.pipe(plumber())
.pipe(less())
.pipe(gulp.dest('./dist/styles'));
});
// Style transform
gulp.task('style-transform', gulp.series(['copy-styles', 'lesscss']));
// Bable transform
gulp.task('bable-transform', function () {
return gulp.src(['./src/**/*.js', '!./src/**/*.stories.js'])
.pipe(plumber())
.pipe(babel({}))
.pipe(dest('./dist'))
});
gulp.task('default', gulp.series('clean', 'bable-transform', 'style-transform'));