Gruntjs Grunt未使用Grunt contrib concat连接

Gruntjs Grunt未使用Grunt contrib concat连接,gruntjs,grunt-contrib-concat,Gruntjs,Grunt Contrib Concat,我的GrunFile.js中包含以下内容: concat: { options: { // define a string to put between each file in the concatenated output separator: ';' }, dist: { // the files to concatenate src: [ 'scripts/jquery.easing.1.3.js', 'scr

我的GrunFile.js中包含以下内容:

concat: {
  options: {
    // define a string to put between each file in the concatenated output
    separator: ';'
  },
  dist: {
    // the files to concatenate
    src: [
        'scripts/jquery.easing.1.3.js', 
        'scripts/SmoothScroll.js',
        'scripts/jquery.parallax-1.1.3.js', 
        'scripts/jquery.bxslider.js',
        'scripts/jquery.hoverdir.js', 
        'scripts/jquery.mixitup.js',
        'scripts/jquery.fitvids.js', 
        'scripts/respond.min.js',
        'scripts/theme.script.js', 
        'scripts/theme.settings.js'
    ],
    // the location of the resulting JS file
    dest: 'scripts.js'
  }
}
但是当我运行
grunt concat
时,什么都没有发生。任务已加载并注册到:

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('concat', ['concat']);

我没有收到任何错误,但是没有创建文件
scripts.js
。知道我做错了什么吗?

grunt.registerTask('concat',['concat'])的意义是什么


使用相同的名称会导致灾难。只需删除该行,然后重试
grunt concat

在文件中添加src和dest:

concat: {
  options: {
    // define a string to put between each file in the concatenated output
    separator: ';'
  },
  dist: {
    files:[{
    // the files to concatenate
    src: [
        'scripts/jquery.easing.1.3.js', 
        'scripts/SmoothScroll.js',
        'scripts/jquery.parallax-1.1.3.js', 
        'scripts/jquery.bxslider.js',
        'scripts/jquery.hoverdir.js', 
        'scripts/jquery.mixitup.js',
        'scripts/jquery.fitvids.js', 
        'scripts/respond.min.js',
        'scripts/theme.script.js', 
        'scripts/theme.settings.js'
    ],
    // the location of the resulting JS file
    dest: 'scripts.js'
    }]
  }
}

grunt.registerTask('concat',['concat'])的意义是什么?使用相同的名称会导致灾难。只需删除该行,然后重试
grunt concat
。啊,这就是问题所在。我以为你必须注册所有任务,但我想那只是为了做多个任务?如果你真的要创建一个新任务,你需要注册一个任务。在这里,您几乎不用concat任务(由插件定义)。不管怎样,这解决了你的问题吗?是的。非常感谢。如果你把它作为答案写下来,我会接受的。我把它作为答案贴了出来。很高兴它有帮助!最好的。