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

Dynamic target-name resolution via function as argument. #100

Closed
ktstowell opened this issue Jul 9, 2015 · 4 comments
Closed

Dynamic target-name resolution via function as argument. #100

ktstowell opened this issue Jul 9, 2015 · 4 comments

Comments

@ktstowell
Copy link

I've added some functionality on my fork (https://github.com/ktstowell/gulp-concat) that allows the user to pass in a function as the first argument (or as the value of path). The returned value would then be used as the target for file contents.

Running the test suite would further elaborate what I was trying to accomplish. Basically, with the given glob of: ['scripts/one/**/*.js', 'scripts/two/**/*.js', ''scripts/three/**/*.js'] to result in the contained files of each directory in a dedicated file of the user's choosing - in the case of the test: dist/one.js, dist/two.js, dist/three.js.

I want to submit a PR but in accommodating this new functionality, I have invalidated some tests and was looking for some guidance as to whether they are still meaningful.

(at 48e757a the last test of 4) should calculate relative path from cwd and path in arguments is failing. It does not seem to be affected by my changes)

So if someone could clone my forked repo and run the tests and check out the changes that would be great. If it sounds like something gulp-concat would be interested in I will open a PR.

Thanks!

@yocontra
Copy link
Member

yocontra commented Jul 9, 2015

I feel like this could be solved easily with a meta stream tool instead of putting it into the lib. Branching based on filename is a very common use case and shouldn't be built into every single plugin. Have you tried using gulp-if for this?

.pipe(gif('a/b/**/*.js', concat('b.js'))
.pipe(gif('a/c/**/*.js', concat('c.js'))
// etc

@ktstowell
Copy link
Author

Definitely achievable via gulp-if, which is how I have traditionally done it. The idea was to be able to handle JIT target names if the structure of the app is dynamic.

This is why I'm putting some feelers out there: to see if this has any philosophical alignment to the project.

@yocontra
Copy link
Member

yocontra commented Jul 9, 2015

I think gulp-if or other stream meta-tools are the way to handle this since it is such a common thing you would do with other plugins as well

@ktstowell
Copy link
Author

That's fair. Thanks for the involvement and feedback!

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

No branches or pull requests

2 participants