mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
33 lines
854 B
JavaScript
33 lines
854 B
JavaScript
const fs = require('fs-extra');
|
|
const glob = require('fast-glob');
|
|
const path = require('path');
|
|
const gulp = require('gulp');
|
|
const less = require('gulp-less');
|
|
const csso = require('gulp-csso');
|
|
const postcss = require('gulp-postcss');
|
|
|
|
// compile component css
|
|
gulp.task('compile', () => (
|
|
gulp
|
|
.src(['../es/**/*.less', '../lib/**/*.less'])
|
|
.pipe(less({
|
|
paths: [path.resolve(__dirname, 'node_modules')]
|
|
}))
|
|
.pipe(postcss())
|
|
.pipe(csso())
|
|
.pipe(gulp.dest(file => file.base.replace('.less', '.css')))
|
|
));
|
|
|
|
// icon.less should be replaced by compiled file
|
|
gulp.task('default', ['compile'], () => (
|
|
glob([
|
|
'../es/icon/*.css',
|
|
'../lib/icon/*.css'
|
|
]).then(files => {
|
|
files.forEach(file => {
|
|
file = path.join(__dirname, file);
|
|
fs.copyFileSync(file, file.replace('.css', '.less'));
|
|
});
|
|
})
|
|
));
|