grunt-filerev
grunt-filerev copied to clipboard
Bad dest added when using targets
I had a config that looked like this:
filerev: {
options: {
encoding: 'utf8',
algorithm: 'md5',
length: 8
},
files: {
src: [
'.tmp/build/images/**/*.*',
'.tmp/build/sounds/**/*.*',
'.tmp/build/app.css',
'.tmp/build/app.js'
]
}
}
Which, at the time, did exactly what I wanted. The files were simply replaced in their current directory.
I realized that when I updated images that were referred to in the css/js files, that was not accounted for in their version. So I used targets and separated out the config:
filerev: {
options: {
encoding: 'utf8',
algorithm: 'md5',
length: 8
},
media: {
files: {
src: [
'.tmp/build/images/**/*.*',
'.tmp/build/sounds/**/*.*'
]
}
},
sources: {
files: {
src: [
'.tmp/build/app.css',
'.tmp/build/app.js'
]
}
}
}
I switched my compilation to use both. However, now the files were being renamed and put in the "src" directory.
You've used 'file object format' ("...where the property name is the destination file...") - that's why your stuff is going in a 'src' folder. you want 'file array format':
files: [
{
src: [
// etc
]
// implicit dest
}
]