-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
41 lines (37 loc) · 1.06 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
const { src, dest, parallel } = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const header = require('gulp-header');
const less = require('gulp-less');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const pkg = require('./package.json');
const banner = `
/*!
* mdui.editor ${pkg.version} (${pkg.homepage})
* Copyright 2019-${new Date().getFullYear()} ${pkg.author}
* Licensed under ${pkg.license}
*/
`.trim();
function css() {
return src('./src/index.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(header(banner))
.pipe(autoprefixer())
.pipe(rename('editor.css'))
.pipe(sourcemaps.write('./'))
.pipe(dest('./dist/css'));
}
function cssMin() {
return src('./src/index.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(header(banner))
.pipe(autoprefixer())
.pipe(cleanCSS({ compatibility: 'ie11' }))
.pipe(rename('editor.min.css'))
.pipe(sourcemaps.write('./'))
.pipe(dest('./dist/css'));
}
exports.default = parallel(css, cssMin);