grunt-filerev
grunt-filerev copied to clipboard
dropCwd option, fixes #15
filerev: {
options: {
dropCwd: true
},
css: {
expand: true,
cwd: 'public',
src: ['css/main.css'],
dest: 'public'
}
would result:
{ '/css/main.css': '/css/main.4458448b.css' }
instead of:
{ 'public/css/main.css': 'public/css/main.4458448b.css' }
~~If you want to drop heading / as well cwd has to be specified as public/~~
upd. bad idea
+1 merge
:+1: (might be useful to add some tests, though)
I have rewritten the hole thing.
Forget to encount the platform's specific path issues (like slashes / \\).
Anyway. Here the few examples how the current version works.
{1}. Getting rid of public:
filerev: {
options: {
dropCwd: true
},
css: {
expand: true,
cwd: 'public',
src: ['css/main.css'],
dest: 'public'
}
{ 'css/main.css': 'css/main.4458448b.css' }
{2}. Nested paths:
filerev: {
options: {
dropCwd: true
},
css: {
expand: true,
cwd: 'public/css',
src: ['main.css'],
dest: 'public/css'
}
{ 'main.css': 'main.4458448b.css' }
{3}. Nested paths (unobvious):
filerev: {
options: {
dropCwd: true
},
css: {
expand: true,
cwd: 'public/css',
src: ['main.css'],
dest: 'public/assets'
}
For the dest it'll drop the part of the path which is matching cwd:
{ 'main.css': 'assets/main.4458448b.css' }
Does it work in crazy-windows-backslash-world?
Yes, I've checked on both windows and linux, produced the same result.
Cool, :+1: