Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

dropCwd option, fixes #15 #44

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

dropCwd option, fixes #15 #44

wants to merge 4 commits into from

Conversation

sladex
Copy link

@sladex sladex commented Sep 9, 2014

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

@madrobot
Copy link

+1 merge

@nelsonpecora
Copy link
Contributor

👍 (might be useful to add some tests, though)

@sladex
Copy link
Author

sladex commented Nov 29, 2014

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' }

Conflicts:
	Gruntfile.js
	tasks/filerev.js
@nelsonpecora
Copy link
Contributor

Does it work in crazy-windows-backslash-world?

@sladex
Copy link
Author

sladex commented Dec 1, 2014

Yes, I've checked on both windows and linux, produced the same result.

@nelsonpecora
Copy link
Contributor

Cool, 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants