server/gulpfile.js

35 lines
862 B
JavaScript

const gulp = require('gulp')
const cleanCSS = require('gulp-clean-css')
const terser = require('gulp-terser')
const developmentPath = './assets/development'
const productionPath = './assets/production'
function minifyStyles() {
return gulp.src(developmentPath + '/styles/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest(productionPath + '/styles'))
}
function minifyScripts() {
return gulp.src(developmentPath + '/scripts/*.js')
.pipe(terser())
.pipe(gulp.dest(productionPath + '/scripts'))
}
function copyFavicon() {
return gulp.src(developmentPath + '/favicon.ico')
.pipe(gulp.dest(productionPath))
}
function copyImages() {
return gulp.src(developmentPath + '/imgs/*')
.pipe(gulp.dest(productionPath + '/imgs'))
}
exports.build = gulp.series(
copyImages,
copyFavicon,
minifyScripts,
minifyStyles
)