This commit is contained in:
Kyle Spearrin 2019-04-02 23:22:37 -04:00
parent b2c0b02be4
commit 18f659de7b

View file

@ -1,19 +1,39 @@
const gulp = require('gulp'); const gulp = require('gulp');
const gulpLess = require('gulp-less'); const gulpLess = require('gulp-less');
const del = require('del'); const del = require('del');
const fs = require('fs');
const paths = {
css: './src/App/Css',
};
const lessFiles = [
'./src/App/Less/android.less',
'./src/App/Less/ios.less',
'./src/App/Less/dark.less',
'./src/App/Less/styles.less',
];
function less() { function less() {
return gulp.src([ return gulp.src(lessFiles).pipe(gulpLess()).pipe(gulp.dest(paths.css));
'./src/App/Less/android.less', }
'./src/App/Less/ios.less',
'./src/App/Less/dark.less', function fixLess(cb) {
'./src/App/Less/styles.less' fs.readdir(paths.css, (err, cssFiles) => {
]).pipe(gulpLess()).pipe(gulp.dest('./src/App/Css')); cssFiles.forEach((cssFile) => {
const file = paths.css + '/' + cssFile;
let fileContents = fs.readFileSync(file, 'utf8');
fileContents = fileContents.replace(/ \^ /g, '^');
fs.writeFileSync(file, fileContents, 'utf8');
});
cb();
});
} }
function cleanCss() { function cleanCss() {
return del('./src/App/Css'); return del(paths.css);
} }
exports.cleanCss = cleanCss; exports.cleanCss = cleanCss;
exports.less = gulp.series(cleanCss, less); exports.fixLess = fixLess;
exports.less = gulp.series(cleanCss, less, fixLess);