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

[Feature] Append/Merge Files #154

Closed
kpalatzky opened this issue Oct 6, 2017 · 12 comments
Closed

[Feature] Append/Merge Files #154

kpalatzky opened this issue Oct 6, 2017 · 12 comments

Comments

@kpalatzky
Copy link

Currently, there is only one option to overwrite the contents of a file, but none to merge the contents. Here it would make sense to offer a append option. If this is set to true, the files should be merged.

Here is an example of the expected result:

# file: ./default/phrases.txt
name: Name
markdown: Markdown
# file: ./production/phrases.txt
title: CopyWebpack

The result should be following (./dist/phrases.txt):

# file: ./default/phrases.txt
name: Name
markdown: Markdown
# file: ./production/phrases.txt
title: CopyWebpack

This feature has already been implemented by myself. You can find it in this fork:
https://github.com/kpalatzky/copy-webpack-plugin

If you are interested, you can do it yourself or I will prepare a pull request for you.

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Oct 6, 2017

Could you keep an eye on #103 which proposes a merge option for patterns ? Needs a rebase first though :). Feel free to open a PR proposing your implementation aswell of course 😛

@markwoon
Copy link

I'd love to see this feature.

@michael-ciniawsky Is this dependent on #103? Or can this proceed regardless? It looks like such a simple change...

@michael-ciniawsky
Copy link
Member

@markwoon Nope it doesn't, feel always free to open a PR

@markwoon
Copy link

@kpalatzky Can you submit a PR, or would you be OK with me creating a PR based on your changes?

@alexander-akait
Copy link
Member

@markwoon PR welcome

@kpalatzky
Copy link
Author

@markwoon It would be great if you can create the PR, because i have currently no time for it. If you dont want do it, i can do it within the next weeks.

@kkennis
Copy link

kkennis commented Nov 2, 2017

Is anybody actively working on this? I've found I have a need for this feature as well.

If not, I am happy to construct and submit the PR. I've tried @kpalatzky's fork, and I could bring in that logic and write some tests. I can do it tomorrow.

@joshwiens
Copy link
Member

joshwiens commented Nov 2, 2017

This plugins intent isn't to merge file contents, it copies files from point A to point B & loaders & plugins for the most part should do one thing.

If someone wants to create a plugin, technically another one as there are already a few feel free. If someone want to create one within contrib, feel free to contact me.

In either case, extending the API to handle merging / appending / stitching / truncating of file contents is functionality that is outside the scope of this plugin.

@kpalatzky
Copy link
Author

@d3viant0ne I think that if you often have the same from path you need more than one way to deal with it.
Most files are also copied, but files with the same name have to be merged here.

In our case we have multible plugins with the same file (core.css):
plugin1/css/core.css
plugin1/css/theme.css
plugin2/css/core.css
plugin3/css/core.css

And we are building one project out of these plugins:
all/css/core.css
all/css/theme.css

In this case you can copy the theme.css file, because it only exists once. But how do you want to handle the core.css file. To add an new webpack plugin which is only responsable for "mergin files" cant be used, because you do not know which files have to be merged and which not...

Therefore, the only reasonable reason is to add additional parameters is to this plugin.

@kpalatzky
Copy link
Author

@d3viant0ne @kkennis @markwoon Are there any updates on this?

@joshgillingham
Copy link

This would be a great feature!

@alexander-akait
Copy link
Member

Now you can do it using the transformAll option #596, release will be today

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

No branches or pull requests

7 participants