tettusud / merge-jsons-webpack-plugin

This plugin is used to merge json files into single json file,using glob or file names
https://npmjs.com/package/merge-jsons-webpack-plugin
Apache License 2.0
36 stars 20 forks source link

Add support for custom "prefixFileName" function #49

Closed ghost closed 5 years ago

ghost commented 5 years ago

For now, prefixes are generated using the hardcoded function which is not sufficient for some more complicated cases.

Let's assume the following input files:

With true passed to the prefixFileName option, the result will be {"example1.en": {...}, "example2.en": {...}}. But when input files are grouped by the language-based pattern, the .en postfix is redundant.

The proposed solution is backward compatible and does not introduce any breaking change. Only if a function is passed as the prefixFileName parameter, it will be called to generate a prefix.

tettusud commented 5 years ago

@pwachala Awesome, thank you much for taking time to make this code better!