简体   繁体   中英

How can I configure my Grunt.js file to copy a directory without a particular subdirectory during the build?

Given that the Gruntfile is located in parent/aurora/Gruntfile.js,

I'd like to configure Grunt to do the following when the build command is executed:

  • copy the entire project directory into parent/build/aurora EXCEPT /parent/aurora/node_modules
  • once the directory haas been copied, create a zip file and delete the directory

https://github.com/antonpug/aurora/blob/master/Gruntfile.js

If you don't want to copy files or a directory you can just preface the files you don't want to include with ! . For example, if you don't want to copy a directory just use: !/parent/aurora/node_modules/** .

In your grunt task:

files: [ 
      { 
        src: ['your_files', '!/parent/aurora/node_modules/**'], 
        dest: 'output/folder'
      }
   ]

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM