const gulp = require('gulp'),
    minify = require('gulp-minify'),
    cssmin = require('gulp-cssmin'),
    rename = require('gulp-rename'),
    postcss = require('gulp-postcss');

// compress javascript files and move them to the dist folder
gulp.task('compress', () => {
    gulp.src('src/*.js')
        .pipe(minify({
            ext:{
                src:'.js',
                min:'.min.js'
            },
            exclude: ['tasks']
        }))
        .pipe(gulp.dest('dist'))
});

// apply post css actions on the css and move to the dist folder
gulp.task('css', function () {
    return gulp.src('./src/*.css')
        .pipe(postcss())
        .pipe(gulp.dest('dist'));
});

// minify the css that's in the dist folder
gulp.task('minify-css', function () {
    gulp.src('dist/scroll-top.css')
        .pipe(cssmin())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest('dist'));
});

// go nuts
gulp.task('default', ['compress', 'css', 'minify-css']);

const gulp = require('gulp'),
    minify = require('gulp-minify'),
    cssmin = require('gulp-cssmin'),
    rename = require('gulp-rename'),
    postcss = require('gulp-postcss');

// compress javascript files and move them to the dist folder
gulp.task('compress', () => {
    return gulp.src('src/*.js')
        .pipe(minify({
            ext:{
                src:'.js',
                min:'.min.js'
            },
            exclude: ['tasks']
        }))
        .pipe(gulp.dest('dist'))
});

// apply post css actions on the css and move to the dist folder
gulp.task('css', function () {
    return gulp.src('./src/*.css')
        .pipe(postcss())
        .pipe(gulp.dest('dist'));
});

// minify the css that's in the dist folder
gulp.task('minify-css',['css'], function () {
    gulp.src('dist/scroll-top.css')
        .pipe(cssmin())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest('dist'));
});

// go nuts
gulp.task('default', ['compress', 'minify-css']);

Fix gulp not minifying the css
Fix gulp not minifying the css

Since Gulp doesn't wait for one task to be completed in order to execute
the second one, we hade some troubles with our default gulp task: the
css wasn't minified because there was no css to minify in the dist
folder yet.
This commit fixes this by adding the "css" task to the "minify-css"
task. So "css" is executed first and then the "minify-css" task is
executed if you call the "minify-css" task.
