【问题标题】:Grunt Copy task does not copy parent folder's file into the correct folderGrunt Copy 任务不会将父文件夹的文件复制到正确的文件夹中
【发布时间】:2015-02-11 22:47:06
【问题描述】:

我现在的树是:

root
├── web-server.js
├── app
     ├── grunt.js
     ├── dist

我的 grunt 文件是:

    copy: {
    commons: {
        src: ['../web-server.js'],
        dest: 'dist/'
    }

},

当我从 app 文件夹执行脚本时,我的 web-server.js 不会复制到“dist”文件夹,而是复制到“app”文件夹。

有什么想法吗?

谢谢

【问题讨论】:

    标签: javascript gruntjs grunt-contrib-copy


    【解决方案1】:

    您应该使用cwd 选项。因此,文件夹结构将被保留。

    如下更改你的 Grunt 任务:

    copy: {
        commons: {
            cwd : '../',
            src  : ['web-server.js'],
            dest : 'dist/',
            expand: true
        }    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      相关资源
      最近更新 更多