Search code examples
gruntjscopycopy-pastegrunt-contrib-uglify

How to exclude a single file from a directory while using npm copy


I have a public folder inside that there is a index.html file which has to be excluded which copying to the distribution folder how to do that

copy: {
      main: {
        files: [
            {expand: true, cwd: 'public/', src: ['**'], dest: '../Distribution/public/'},
        ]
      }
    }

here in the source i want all the files in public folder to /Distribution/public/ except index.html which is present in public


Solution

  • I fiqured i out just include the file in source as shoen below

    copy: {
          main: {
            files: [
                {expand: true, cwd: 'public/', src: ['**','!index.html'], dest: '../Distribution/public/'},
            ]
          }
        }