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