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');
|
2018-02-04 05:13:14 +10:00
|
|
|
const runsequence = require('run-sequence');
|
2018-01-07 04:55:48 +10:00
|
|
|
|
|
|
|
gulp.task('compressJS', () => {
|
2018-02-04 05:13:14 +10:00
|
|
|
return gulp.src(['public/javascripts/*.js', '!public/javascripts/*.min.js'])
|
2018-01-07 04:55:48 +10:00
|
|
|
.pipe(minify({
|
|
|
|
ext: {
|
|
|
|
src: '.js',
|
|
|
|
min: '.min.js'
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest('public/javascripts'));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('compressCSS', () => {
|
|
|
|
return gulp.src(['public/stylesheets/*.css',
|
|
|
|
'!public/stylesheets/*.min.css',
|
|
|
|
'public/themes/*.css',
|
|
|
|
'!public/themes/*.min.css'
|
|
|
|
])
|
|
|
|
.pipe(cleanCSS({compatibility: 'ie8'}))
|
|
|
|
.pipe(rename({
|
|
|
|
dirname: 'public/stylesheets',
|
|
|
|
extname: '.min.css'
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest('./'));
|
|
|
|
});
|
|
|
|
|
|
|
|
// run the tasks
|
2018-02-04 05:13:14 +10:00
|
|
|
gulp.task('deploy', (callback) => {
|
|
|
|
runsequence('compressJS', 'compressCSS', callback);
|
|
|
|
});
|