Gruntjs 通过grunt安装bower不会将所有文件复制到targetDir

Gruntjs 通过grunt安装bower不会将所有文件复制到targetDir,gruntjs,polymer,bower,Gruntjs,Polymer,Bower,在继承的polymer 1.0项目中,安装程序涉及一个Grunfile,它调用bower来安装必要的资源。但是,在后面的步骤中,无法找到某些文件,grunt任务失败。我对鲍尔和格伦特都是新手,感觉有点失落 无法找到的文件是myproject\components\polymer\polymer mini.html,尽管我通过手动复制文件发现了更多类似的位置 我的第一步是隔离bower安装任务,并在它工作时观察它。这是它在grunfile.js中的配置: bower: { install:

在继承的polymer 1.0项目中,安装程序涉及一个Grunfile,它调用bower来安装必要的资源。但是,在后面的步骤中,无法找到某些文件,grunt任务失败。我对鲍尔和格伦特都是新手,感觉有点失落

无法找到的文件是
myproject\components\polymer\polymer mini.html
,尽管我通过手动复制文件发现了更多类似的位置

我的第一步是隔离bower安装任务,并在它工作时观察它。这是它在
grunfile.js
中的配置:

bower: {
    install: {
        options: {
            targetDir: './components', 
            layout: 'byType', 
            install: true,
            verbose: false,
            cleanTargetDir: true, 
            cleanBowerDir: true, 
            bowerOptions: {}
        }
    }
}
通过在详细模式下执行单个步骤后暂停执行,我发现在安装过程中会发生以下情况:

  • 旧的
    myproject/components
    文件夹(如果存在)将被删除
  • 文件在
    myproject/bower\u components
    文件夹中正常创建
  • 然后将文件复制到targetDir
    myproject/components
  • 然而,并不是所有的文件都到达了那里
  • myproject/bower\u组件
    在复制后被删除
比较
myproject/bower_components
myproject/components
的内容,发现目标文件夹中缺少原始文件夹中的许多文件。例如,提到的
myproject/components/polymer
仅包含一个
polymer.html
——然而,在
myproject/bower\u components/polymer
中有七个文件,包括缺少的
polymer mini.html

显然,有些东西会过滤复制到targetDir的内容和未复制到targetDir的内容


我是否可以以任何方式影响此设置,或者此设置是否像现在这样正确?我已经看到了,但不能做太多-除了公认的解决方案显然是在安装
bower\u组件后手动复制所有内容。当然,一定有更好的方法吗?

我通过调用一个配置如下的
copy
任务,独立于bower任务复制了文件:

copy: {
        main: {
            files: [
                { expand: true, cwd: 'bower_components/', src: ['**'], dest: 'components/', filter: 'isFile' }, // bower components
            ]
        }
    }
当然,在这种情况下,必须重新配置bower任务,以避免删除要从中复制的bower目录

bower: {
    install: {
        options: {
            targetDir: './components', 
            layout: 'byType', 
            install: true,
            verbose: false,
            cleanTargetDir: true, 
            cleanBowerDir: false,
            bowerOptions: {}
        }
    }
}
这并不是我真正希望的,但同时它完成了工作