Ответ 1
Grunt встроенная concat задача (я рекомендую посмотреть исходный код) не поддерживает ничего, как dest: 'prod/js/*.js'
, вам нужно будет указать каждый вывод целевой отдельно, что является излишним в вашем случае.
Лучше всего просто написать свой собственный код (возможно, обернуть его в пользовательскую задачу), это довольно просто. Вот простая многозадачная упаковка. Не обещайте надежного и безопасного использования:)
grunt.registerMultiTask('wrap', 'Wraps source files with specified header and footer', function() {
var data = this.data,
path = require('path'),
dest = grunt.template.process(data.dest),
files = grunt.file.expandFiles(this.file.src),
header = grunt.file.read(grunt.template.process(data.header)),
footer = grunt.file.read(grunt.template.process(data.footer)),
sep = grunt.utils.linefeed;
files.forEach(function(f) {
var p = dest + '/' + path.basename(f),
contents = grunt.file.read(f);
grunt.file.write(p, header + sep + contents + sep + footer);
grunt.log.writeln('File "' + p + '" created.');
});
});
Загрузите его с помощью такой конфигурации:
wrap: {
html: {
header: '<%= project.partials %>/head.html',
footer: '<%= project.partials %>/footer.html',
src: [
'<%= project.pages %>/index.html',
'<%= project.pages %>/about.html',
'<%= project.pages %>/blog.html'
],
dest: '.' // destination *directory*, probably better than specifying same file names twice
}
}
На всякий случай я также обновил вашу скрипку: http://jsfiddle.net/dipish/hKkGX/