-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (32 loc) · 888 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
const { src, dest, parallel } = require('gulp');
const less = require('gulp-less');
const minifyCSS = require('gulp-csso');
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const polyfill = require('@babel/polyfill');
const ptfo = require('@babel/plugin-transform-for-of');
const uglify = require('gulp-uglify');
const [pthDist, pthSrc] = [
'dist/',
'src/',
];
console.log('>>>', pthDist, pthSrc);
function css() {
return src(`${pthSrc}/*.less`)
.pipe(less())
.pipe(minifyCSS())
.pipe(dest(pthDist));
}
function js() {
return src(`${pthSrc}*.js`, { sourcemaps: false })
.pipe(babel({
presets: ['@babel/env'],
plugins: [polyfill, ptfo],
}))
.pipe(uglify())
.pipe(concat('index.js'))
.pipe(dest(pthDist, { sourcemaps: false }));
}
exports.js = js;
exports.css = css;
exports.default = parallel(css, js);