我的Gruntfile.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
。知道我做错了吗?
答案 0 :(得分:0)
grunt.registerTask('concat', ['concat']);
有什么意义?
使用相同的名称是灾难的秘诀。只需删除该行,然后重试grunt concat
。
答案 1 :(得分:0)
在文件中添加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'
}]
}
}