Gruntfile.js三种写作方式
++注:我们将以grunt中的copy命令举例++
1. src和desk模式(采用不同任务来执行操作)
copy:{
build-1:{
src:'<%= config.src %>/index.html',
dest:'<%= config.app %>/index.html'
},
build-2:{
src:'<%= config.src %>/js/index.js',
dest:'<%= config.app %>/js/index.js'
}
}
2. files数组模式(采用files数组模式定义不同的src和dest对象)
copy:{
build:{
files:[
{
src:'<%= config.src %>/index.html',
dest:'<%= config.app %>/index.html'
},
{
src:'<%= config.src %>/js/index.js',
dest:'<%= config.app %>/js/index.js'
}
]
}
}
3. files对象模式(采用files对象模式定义不同的src和dest属性)
copy:{
build:{
files:{
'<%= config.app %>/index.html':'<%= config.src %>/index.html',
'<%= config.app %>/js/index.js’:'<%= config.src %>/js/index.js'
}
}
}