简体   繁体   English

如何在构建过程中配置Grunt.js文件以复制没有特定子目录的目录?

[英]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, 假设Gruntfile位于parent / aurora / Gruntfile.js中,

I'd like to configure Grunt to do the following when the build command is executed: 我想配置Grunt在执行build命令时执行以下操作:

  • copy the entire project directory into parent/build/aurora EXCEPT /parent/aurora/node_modules 将整个项目目录复制到parent / build / aurora除/ parent / aurora / node_modules外
  • once the directory haas been copied, create a zip file and delete the directory 复制目录后,请创建一个zip文件并删除该目录

https://github.com/antonpug/aurora/blob/master/Gruntfile.js 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/** . 例如,如果您不想复制目录,请使用: !/parent/aurora/node_modules/**

In your grunt task: 在您艰苦的任务中:

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

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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