Gulp exclude does not work as expected

我是研究僧i 提交于 2019-12-24 06:21:07

问题


I have a gulp task that looks like this, just the src part:

gulp.src(
    [
    'site/bricks/global/global.scss',
    'site/bricks/**/*.scss',
    '!site/bricks/global/domain*.scss',
    'site/bricks/global/domain.mydomain.com.scss'
    ])

I expect it to do this:

  • Load global.scss first (works)
  • Load the rest of the scss files (works)
  • Exclude all but domain (works)
  • Include one of my domains back (does not work)

So for some reason I can't add a domain back to the list. Any ideas?


回答1:


It looks like that is expected behavior because all negation globs run last! See gulp.src negation order issues.

You have a few options though:

1.. Use gulp4.0 - supposed to be fixed there.

2.. gulp-add-src add that last file back in.

3.. merge2 create two separate streams and then merge them.



来源:https://stackoverflow.com/questions/46319426/gulp-exclude-does-not-work-as-expected

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!