Navigation

    云、贵、川、渝IT人的圈子
    • Register
    • Login
    • Search
    • 主页
    • 问答
    • 话题
    • 热门
    • 圈子
    • 招聘
    • 活动
    • 项目

    gulp 怎么忽略文件?

    技术答疑
    2
    2
    22
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cangcenchao33
      cangcenchao33 last edited by

      我在做一个编译html的任务,它把 node_modules 里面的html都找出来了,怎么忽略 node_module 这文件夹呢?

      gulp.task('html', function() {
        return gulp
          .src('./**/*.html')
          .pipe(preprocess({
            context: {
              NODE_ENV: "production",
              DEBUG: true
            }
          })) // To set environment variables in-line
          .pipe(gulp.dest('./../dist/'))
      })
      
      1 Reply Last reply Reply Quote 0
      • 花
        花都绮梦 last edited by

        在路径前面加一个 !代表忽略
        上方的代码可以这样修改

        gulp.task('html', function() {
          return gulp
            .src(['./**/*.html', '!./node_modules/**/*'])
            .pipe(preprocess({
              context: {
                NODE_ENV: "production",
                DEBUG: true
              }
            })) // To set environment variables in-line
            .pipe(gulp.dest('./../dist/'))
        })
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        花
        千
        I
        Y
        E
        O
        A
        社
        8
        玻
        U
        A
        大
        A
        黑
        低
        天
        白
        快
        爱
        白
        美

        社群
        昆明网页设计交流吧
        友情链接
        • Funtask
        • Funtask 社区
        • SUWIS
        ©2019-2021 滇ICP备20006698号