4
Im新增了一些Gulp ..我已經能夠成功安裝和連接並縮小我的.js和.css文件,但是,有一個.css文件需要排除 - print.cssgulp - 在縮小CSS時排除一個文件
伊夫按照說明這裏:https://www.npmjs.org/package/gulp-ignore安裝在我的本地目錄一飲而盡-忽略,並且修改了我的gulpfile.js到:
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifyCSS = require('gulp-minify-css');
var imagemin = require('gulp-imagemin');
var exclude = require('gulp-ignore').exclude;
var paths = {
scriptsNonAuth: ['Non-Auth/javascript/*.js'],
scriptsAuth: ['Auth/javascript/*.js'],
stylesNonAuth: ['Non-Auth/css/*.css'],
stylesAuth: ['Auth/css/*.css'],
};
// CSS Task - Non Authenticated
gulp.task('minify-css-non-auth', function() {
gulp.src(paths.stylesNonAuth)
.pipe(minifyCSS(opts))
.pipe(concat('all.min.css'))
.pipe(gulp.dest('Non-Auth/css'))
});
// CSS Task - Authenticated
gulp.task('minify-css-auth', function() {
gulp.src(paths.stylesAuth)
.pipe(minifyCSS(opts))
**.pipe(exclude('Auth/css/print.css'))**
.pipe(concat('all.min.css'))
.pipe(gulp.dest('Auth/css'))
});
在我的CSS任務 - 安全,我已經包括.pipe (排除('Secure/css/print.css'))
當我運行lp minify -css-secure,任務完成,但在檢查新的all.min.css時,我不能在那裏看到print.css的內容。
豎起大拇指爲最後一部分:排除一個爆炸 – Alp