expressCart/gulpfile.js

62 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-10-26 11:05:04 +10:00
const { src, dest, series } = require('gulp');
2018-01-07 04:55:48 +10:00
const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');
const minify = require('gulp-minify');
const rename = require('gulp-rename');
2019-10-26 11:05:04 +10:00
function compressJS(){
return src([
'public/javascripts/*.js',
'!public/javascripts/*.min.js'
])
.pipe(minify({
ext: {
src: '.js',
min: '.min.js'
}
}))
.pipe(dest('public/javascripts'));
2019-10-26 11:05:04 +10:00
};
2018-01-07 04:55:48 +10:00
2019-10-26 11:05:04 +10:00
function compressCss(){
return src([
'public/stylesheets/*.css',
'!public/stylesheets/*.min.css'
])
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename({
dirname: 'public/stylesheets',
extname: '.min.css'
}))
.pipe(dest('./'));
2019-10-26 11:05:04 +10:00
};
2018-01-07 04:55:48 +10:00
2019-10-26 11:05:04 +10:00
function compressThemeCss(){
return src([
'views/themes/**/*.css',
'!views/themes/**/*.min.css'
])
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename({
extname: '.min.css'
}))
.pipe(dest('views/themes/'));
};
function compressThemeJS(){
return src([
'views/themes/**/*.js',
'!views/themes/**/*.min.js'
])
.pipe(minify({
ext: {
src: '.js',
min: '.min.js'
}
}))
.pipe(dest('views/themes/'));
2019-10-26 11:05:04 +10:00
};
2018-02-14 07:15:14 +10:00
2018-01-07 04:55:48 +10:00
// run the tasks
gulp.task('default', series(compressJS, compressCss, compressThemeCss, compressThemeJS));