Fixing gulp file

master
Mark Moffat 2019-10-26 11:35:04 +10:30
parent 3c9a86306a
commit bdf0e8c59d
1 changed files with 14 additions and 15 deletions

View File

@ -1,21 +1,22 @@
const { src, dest, series } = require('gulp');
const gulp = require('gulp'); const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css'); const cleanCSS = require('gulp-clean-css');
const minify = require('gulp-minify'); const minify = require('gulp-minify');
const rename = require('gulp-rename'); const rename = require('gulp-rename');
gulp.task('compressJS', () => { function compressJS(){
return gulp.src(['public/javascripts/*.js', '!public/javascripts/*.min.js']) return src(['public/javascripts/*.js', '!public/javascripts/*.min.js'])
.pipe(minify({ .pipe(minify({
ext: { ext: {
src: '.js', src: '.js',
min: '.min.js' min: '.min.js'
} }
})) }))
.pipe(gulp.dest('public/javascripts')); .pipe(dest('public/javascripts'));
}); };
gulp.task('compressCss', () => { function compressCss(){
return gulp.src(['public/stylesheets/*.css', return src(['public/stylesheets/*.css',
'!public/stylesheets/*.min.css' '!public/stylesheets/*.min.css'
]) ])
.pipe(cleanCSS({ compatibility: 'ie8' })) .pipe(cleanCSS({ compatibility: 'ie8' }))
@ -23,21 +24,19 @@ gulp.task('compressCss', () => {
dirname: 'public/stylesheets', dirname: 'public/stylesheets',
extname: '.min.css' extname: '.min.css'
})) }))
.pipe(gulp.dest('./')); .pipe(dest('./'));
}); };
gulp.task('compressThemeCss', () => { function compressThemeCss(){
return gulp.src(['views/themes/**/*.css', return src(['views/themes/**/*.css',
'!views/themes/**/*.min.css' '!views/themes/**/*.min.css'
]) ])
.pipe(cleanCSS({ compatibility: 'ie8' })) .pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename({ .pipe(rename({
extname: '.min.css' extname: '.min.css'
})) }))
.pipe(gulp.dest('views/themes/')); .pipe(dest('views/themes/'));
}); };
// run the tasks // run the tasks
gulp.task('deploy', gulp.series('compressJS', 'compressCss', 'compressThemeCss', (done) => { gulp.task('default', series(compressJS, compressCss, compressThemeCss));
done();
}));