grunt-contrib-concat错误:它复制了我的文件

时间:2016-04-21 14:38:40

标签: gruntjs grunt-contrib-concat

我使用grunt concat,每个文件在结果文件中重复11次。

这是我的Gruntfile:

 module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        concat: {
            options: {
                separator: '\n\n'
            },
            JSTemplateApplication: {
                src: [
                    'XXXTemplate/**/*.js'
                ],
                dest: 'XXXTemplate/_dist/template.js'
            },
            JSTemplateTests: {
                src: [
                    'XXXTemplateTests/qunit/**/*.js'
                ],
                dest: 'XXXTemplateTests/_build/tests.js'
            }              
        },

        copy: {
            options: {
                separator: '\n\n',
                punctuation: ''
            },
            test: {
                src: "XXXTemplate/_dist/template.js",
                dest: "XXXTemplateTests/_source/template.js"
            },
            postman: {
                src: "XXXTemplate/_dist/template.js",
                dest: "postman/_source/template.js"                
            }
        },        

        connect: {
            test: {
                options: {
                    port: 8081,
                    hostname: '127.0.0.1',
                    keepalive: true
                    /*open: {
                        target: 'http://127.0.0.1:8081/XXXTemplateTests/index.html',
                        appName: 'Chrome'
                    }*/
                }                
            }
        }
    });

    grunt.loadNpmTasks('grunt-copy');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-connect');

    grunt.registerTask('default', ['concat:JSTemplateApplication', 'concat:JSTemplateTests', 'copy:test', 'connect:test']);
};

更奇怪的是,只有JSTemplateApplication部分中的文件是重复的。 JSTemplateTests中的文件不是。

以下是concat部分的--verbose日志:

Running "concat:JSTemplateApplication" (concat) task
Verifying property concat.JSTemplateApplication exists in config...OK
Files: XXXTemplate/_ctor.js, XXXTemplate/_execute.js, XXXTemplate/_init.js, XXXTemplate/adChoiceIcon/_ctor.js, XXXTemplate/adChoiceIcon/_execute.js, XXXTemplate/adChoiceIcon/init.js, XXXTemplate/adChoiceIcon/setupIconAnimation.js, XXXTemplate/dom.js, XXXTemplate/i18n/_ctor.js, XXXTemplate/i18n/_execute.js, XXXTemplate/i18n/setLanguage.js, XXXTemplate/setupButtonsUri/_ctor.js, XXXTemplate/setupButtonsUri/_execute.js, XXXTemplate/setupButtonsUri/formatclickButtonUrl.js, XXXTemplate/setupButtonsUri/startJSEventListeners.js, XXXTemplate/setupButtonsUri/startUnityEventListeners.js, XXXTemplate/tools/_ctor.js, XXXTemplate/tools/countDown.js, XXXTemplate/tools/messaging.js, XXXTemplate/tools/objectUtils.js, XXXTemplate/tools/uiUtils.js, XXXTemplate/videoPlayer/_ctor.js, XXXTemplate/videoPlayer/_execute.js, XXXTemplate/videoPlayer/freezeUI/_ctor.js, XXXTemplate/videoPlayer/freezeUI/_execute.js, XXXTemplate/videoPlayer/freezeUI/init.js, XXXTemplate/videoPlayer/freezeUI/resetButtonsState.js, XXXTemplate/videoPlayer/freezeUI/updateButtonCloseLinkText.js, XXXTemplate/videoPlayer/init.js, XXXTemplate/videoPlayer/startRadiantMediaPlayer.js, XXXTemplate/zoom.js -> _dist/template.js
Options: separator="\r\n\r\n", banner="", footer="", stripBanners=false, process=false, sourceMap=false, sourceMapName=undefined, sourceMapStyle="embed"
Reading XXXTemplate/_ctor.js...OK
Reading XXXTemplate/_execute.js...OK
Reading XXXTemplate/_init.js...OK
Reading XXXTemplate/adChoiceIcon/_ctor.js...OK
Reading XXXTemplate/adChoiceIcon/_execute.js...OK
Reading XXXTemplate/adChoiceIcon/init.js...OK
Reading XXXTemplate/adChoiceIcon/setupIconAnimation.js...OK
Reading XXXTemplate/dom.js...OK
Reading XXXTemplate/i18n/_ctor.js...OK
Reading XXXTemplate/i18n/_execute.js...OK
Reading XXXTemplate/i18n/setLanguage.js...OK
Reading XXXTemplate/setupButtonsUri/_ctor.js...OK
Reading XXXTemplate/setupButtonsUri/_execute.js...OK
Reading XXXTemplate/setupButtonsUri/formatclickButtonUrl.js...OK
Reading XXXTemplate/setupButtonsUri/startJSEventListeners.js...OK
Reading XXXTemplate/setupButtonsUri/startUnityEventListeners.js...OK
Reading XXXTemplate/tools/_ctor.js...OK
Reading XXXTemplate/tools/countDown.js...OK
Reading XXXTemplate/tools/messaging.js...OK
Reading XXXTemplate/tools/objectUtils.js...OK
Reading XXXTemplate/tools/uiUtils.js...OK
Reading XXXTemplate/videoPlayer/_ctor.js...OK
Reading XXXTemplate/videoPlayer/_execute.js...OK
Reading XXXTemplate/videoPlayer/freezeUI/_ctor.js...OK
Reading XXXTemplate/videoPlayer/freezeUI/_execute.js...OK
Reading XXXTemplate/videoPlayer/freezeUI/init.js...OK
Reading XXXTemplate/videoPlayer/freezeUI/resetButtonsState.js...OK
Reading XXXTemplate/videoPlayer/freezeUI/updateButtonCloseLinkText.js...OK
Reading XXXTemplate/videoPlayer/init.js...OK
Reading XXXTemplate/videoPlayer/startRadiantMediaPlayer.js...OK
Reading XXXTemplate/zoom.js...OK
Writing _dist/template.js...OK
File _dist/template.js created.

以下是我的软件包版本:

  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-uglify": "^0.9.2",
    "grunt-contrib-connect": "^1.0.1",
    "grunt-copy": "^0.1.0"
  }

感谢您的帮助!

0 个答案:

没有答案