首页 > gulp-dom-src可以排除文件吗

gulp-dom-src可以排除文件吗

不想gulp把jQuery也给合并了,gulp-dom-src有这功能吗?


你可以结合gulp-filter

var jqFilter = filter('**/*.js', {restore: true});

gulp.task('js', function() {
    return domSrc({file:'index.html',selector:'script',attribute:'src'})
        .pipe(jqFilter)
        .pipe(concat('app.full.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest('dist/'));
});

当然gulp-dom-src也可以,你写一个复杂的selector就可以了script:not([src*="jquery"])

【热门文章】
【热门文章】