OKyJIucT
3/3/2017 - 2:49 PM

gulp

gulp

'use strict';

const gulp = require('gulp');
const clean = require('gulp-clean');
const concat = require('gulp-concat');
var cleanCSS = require('gulp-clean-css');
var uncss = require('gulp-uncss');

gulp.task('clear', function () {

    return gulp.src('web/static', {read: false})
        .pipe(clean());
});

gulp.task('css', function () {

    return gulp.src('web/css/*.css')
        .pipe(concat('all.css'))
        .pipe(cleanCSS({compatibility: 'ie8'}))
        .pipe(uncss({
            html: ['views/**/*.php']
        }))
        .pipe(gulp.dest('web/static/css'));
});

gulp.task('js', function () {

    return gulp.src('web/js/*.js')
        .pipe(concat('all.js'))
        .pipe(cleanCSS({compatibility: 'ie8'}))
        .pipe(gulp.dest('web/static/js'));
});


gulp.task('build', gulp.series('clear', gulp.parallel('css', 'js')));