Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixbug for get part of filename when filename contains two '.' #856

Closed
wants to merge 1 commit into from
Closed

Conversation

yss
Copy link

@yss yss commented Jul 29, 2013

when use Building the files object dynamically
like this:

{
    expand: true,
    src: [PATH_SRC + APP_NAME + '/*.js', PATH_SRC + APP_NAME + '/**/*.js'],
    dest: PATH_DEST,
    ext: '.js',
    rename: function(dest, src) { console.log(src);
        var version = getVersion(src, PATH_TMP + APP_NAME + '.json', grunt);
        return version && (dest + version);
    }
}

If there has a js file like zepto.min.js, and the output is zepto.js.

when use [Building the files object dynamically](http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically)
like this:
```js
{
    expand: true,
    src: [PATH_SRC + APP_NAME + '/*.js', PATH_SRC + APP_NAME + '/**/*.js'],
    dest: PATH_DEST,
    ext: '.js',
    rename: function(dest, src) { console.log(src);
        var version = getVersion(src, PATH_TMP + APP_NAME + '.json', grunt);
        return version && (dest + version);
    }
}
```
If there has a js file like zepto.min.js, and the output is zepto.js.
@yss
Copy link
Author

yss commented Jul 30, 2013

My project is broken by this problem.
Hope you can fix it quickly.
And I will report a new version for my own project.

@shama
Copy link
Member

shama commented Jul 30, 2013

Thanks but closing as this is a duplicate of #750, #625, #718, #730.

There's two ways ext could work; it could consider everything after the first dot the extension, or everything after the last dot the extension—it can't be smart enough to "guess" automatically. We chose the former because the use-case is more common (we encounter .min.js files all the time). That being said, you can use the rename option to specify a function that will use whatever custom naming logic you need.

FWIW, I believe support for this way was added in globule which will eventually get upstreamed into grunt.

@shama shama closed this Jul 30, 2013
@sindresorhus
Copy link
Member

@shama that paragraph should probably be in the FAQ in the wiki as I've seen it asked countless of times.

@tkellen
Copy link
Member

tkellen commented Mar 14, 2014

This has been resolved with the extDot option. See:
http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

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

Successfully merging this pull request may close these issues.

4 participants