Javascript grunt注射器-如何使用grunt';s';动态生成文件对象。';?
Grunt动态构建的文件对象的结构为:Javascript grunt注射器-如何使用grunt';s';动态生成文件对象。';?,javascript,node.js,gruntjs,Javascript,Node.js,Gruntjs,Grunt动态构建的文件对象的结构为: files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/', // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/',
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'lib/', // Src matches are relative to this path.
src: ['**/*.js'], // Actual pattern(s) to match.
dest: 'build/', // Destination path prefix.
ext: '.min.js', // Dest filepaths will have this extension.
extDot: 'first' // Extensions in filenames begin after the first dot
},
]
但这种格式在grunt injector中不起作用:
injector: {
options: {
destFile : 'app/static/index.html',
ignorePath: 'app/'
},
local_dependencies: {
files: [
expand: true,
cwd: 'app/static/css/',
src: ['*.css'],
dest: '/static/css',
ext: '.css'
]
}
},
关于如何使用Grunt特定的“动态构建的文件对象”有什么建议吗?如果有人有这个问题,我想你不能使用像local_dependencies这样的子类别 这对我很有用:
injector: {
options: {
destFile : 'app/static/index.html',
ignorePath: 'app/'
},
files: {
expand: true,
cwd: 'app/static/css/',
src: ['*.css'],
dest: 'app/static/css',
ext: '.css'
}
},