简体   繁体   中英

Gulp Minify-CSS deletes CSS

Gulp minify-css is deleting css that I have recently added to my main css file. I have included the block of code that is being deleted by the gulp minify-css command. I have reorganized the css in my directory and also altered the order that cleanCSS is called.

new-age.css:

input[type=email]{
    width: 50%;
    margin-right: 50px;
    color: #000000;
    padding: 1px;
}

gulpfile.js:

// Minify compiled CSS
gulp.task('minify-css', ['less'], function() {
    return gulp.src('css/new-age.css')
        .pipe(cleanCSS())
        .pipe(rename({ suffix: '.min' }))
        .pipe(gulp.dest('css/'))
        .pipe(browserSync.reload({
            stream: true
        }))
});

If your Just just looking to minify CSS try this below, Its old code but it should work still, let me know if it doesn't and i'll write you something up

var minfyCSS = require('gulp-minify-css');

gulp.task('minfy-css', function() {
    return gulp.src('css/new-age.css')
        .pipe(minfyCSS)
        .pipe(rename({ suffix: '.min' }))
        .pipe(gulp.dest('css/'));
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM