-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Should it add file.origin property #19
Comments
This seems non-standard - what are the reasons for adding this? |
Yeah, but it can be standard. If I use some plugin that change the path, and the plugins will save origin path by different name. I don't know where is the real path. gulp.src('*.less') // a.less
.pipe(less()) // change a.css, save file.lessOriginPath
.pipe(rev()) // change a-592823.css. save file.revOriginPath
.pipe(myPlugin()) // want to get origin file.path |
Can you give an example of a plugin? |
Sorry for late response. For example, write a myPlugin above, I want to generate a map that refer to the original file.
yield
|
@contra can you see it? |
The same underlying issue is described in #17. The original path is a missing concept in the vinyl stream object. Vinyl is billed as a virtual file format - there needs to a way figure out reliably to which real file the virtual file corresponds. Clearly this information is useful and there is nowhere else to get it from. The solution proposed here is also cool in that does not break backwards compatibility. Implementation seems straight forward. I'd like to see this problem solved. @contra will you consider a PR? |
It's not that I don't agree, but I don't think this goes far enough. Do you think every time the path is modified we should keep a history of that? We can have a setter on the path field that pushes the previous version to a history array. To get the original one you can do |
that's a good idea— On Sat, Jun 28, 2014 at 3:23 PM, Eric Schoffstall
|
I see. That would certainly solve the issue and is future-proof. I dunno though... Since the intermediate names don't really point to anywhere real I don't see why they would be needed. @popomore to be clear for your use case you just need the original names right? Thinking out load here, looking just at the semantics it seems like there are three separate concepts..
(2) and (3) can be combined into one property, which is effectively the dual purpose the I can't think of a case where the intermediate values would be useful further done the pipe. Once they have been changed they don't refer to anything useful or persistent. Would a transform every need to know that a file was of a certain type at some point but no longer? Maybe for the the double transform issue mentioned in (2) above. Seems very frail to rely on file extensions like that though, probably doesn't make sense to cater to that awkward use case. Unless there is a good use case at hand I'd say best to keep it simple with a single property. Has the advantage of not requiring that existing transforms be updated to push to history. Either approach would solve the issue at hand though. Thanks for looking at this @contra ! Let me know if you'd like a PR for either approach. |
I agree with @dgbeck. I only see a use-case for the |
Yeah, but history can record every change, maybe it's useful in some complex building system. |
I only see a use-case for the original path, but I think all of the info could be useful in visualizing builds and debugging |
I don't. We can add it later if there's an actual need, but right now it's just unnecessary bloat. |
Have been merged |
Some plugin like gulp-rev will change file.path, and save the original path with file.revOrigPath.
I think it's nice that supporting by vinyl.
The text was updated successfully, but these errors were encountered: