From ed91b7e434b6c81461cea45061f0ec88da0fbf63 Mon Sep 17 00:00:00 2001 From: ibcker Date: Wed, 23 Sep 2015 14:03:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=20css=20=E7=BC=96=E8=AF=91=E6=97=B6?= =?UTF-8?q?=E5=BA=8F=E9=97=AE=E9=A2=98=E5=AF=BC=E8=87=B4=E6=9C=89=E4=BA=8B?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E7=94=9F=E6=88=90css?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BE=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gulpfile.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 25b14db3..d6be7c9d 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -45,23 +45,26 @@ var paths = { // CSS task gulp.task('css', function() { - // Convert scss first - gulp.src('app/assets/sass/**/*.scss') +// Cleanup old assets + del(['public/assets/css/styles-*.css'], function (err) {}); + +// Convert scss first +// Prefix, compress and concat the CSS assets +// Afterwards add the MD5 hash to the filename + + return gulp.src('app/assets/sass/**/*.scss') .pipe(sass()) .pipe(autoprefixer('last 10 version')) - .pipe(gulp.dest('app/assets/css/dist')); - - // Cleanup old assets - del(['public/assets/css/styles-*.css'], function (err) {}); + .pipe(gulp.dest('app/assets/css/dist')) + .on('end',function() { + gulp.src(paths.frontend.styles) + .pipe(concat('styles.css')) + .pipe(rev()) + .pipe(filename({ bundleName: 'frontend.styles' })) // This will create/update the assets.json file + .pipe(minifycss()) + .pipe(gulp.dest('public/assets/css')); + }); - // Prefix, compress and concat the CSS assets - // Afterwards add the MD5 hash to the filename - return gulp.src(paths.frontend.styles) - .pipe(concat('styles.css')) - .pipe(rev()) - .pipe(filename({ bundleName: 'frontend.styles' })) // This will create/update the assets.json file - .pipe(minifycss()) - .pipe(gulp.dest('public/assets/css')); }); // JavaScript task