grunt-contrib-copy破坏了二进制文件

时间:2017-07-16 18:26:46

标签: angularjs npm gruntjs grunt-contrib-copy

我正在使用“grunt-contrib-copy”:“^ 1.0.0”并且复制的二进制文件已损坏,请查看我的grunt配置并帮助我。

copy: {
    options: {
        // exclude binary format from the processContent function
        processContentExclude: [
            '**/*.{png,gif,jpg,ico,psd,ttf,otf,woff,svg}'
        ]
    },
    main: {
        files: [{
            expand: true,
            cwd: '<%= options.src %>',
            src: ['**/*.json', '**/*.htm*', '**/*.png'],
            dest: '<%= options.targets.dist %>'
        },
            {
                expand: true,
                cwd: '<%= options.resources %>',
                src: ['**/*.png'],
                dest: '<%= options.targets.dist %>',
                options: {
                    options: {
                        processContentExclude: ['**/*.{png,gif,jpg,ico,psd}']
                    }
                }
            }]
    }
},

1 个答案:

答案 0 :(得分:2)

In grunt-contrib-copy@1.0.0 the processContentExclude option has been renamed to noProcess. Your options object should be:

// ...
options: {
    // ...
    noProcess: [ // <-- Renamed from processContentExclude
        '**/*.{png,gif,jpg,ico,psd,ttf,otf,woff,svg}'
    ]
},
// ...

I also assume that somewhere else in your configuration, (although not included in the OP), you might be using the processContent option - hence the corruption. Note, that the processContent option has been renamed to process so you'll need to rename that too. E.g.

// ...
options: {
    // ...
    process: function(foo, baz) { // <-- Renamed from processContent
        // ...          
    },
    // ...    
}