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

Glob Options handling #24

Closed fabgallo closed 6 years ago

fabgallo commented 6 years ago

First of all, many thanks for your great plugin! We use it in our projects to handle angular components' translations and we came across a couple of scenarios where the order of the to-be-merged JSONs is important, as more specific translations need to override generic ones.

By using the glob option nosort, we are able to achieve that. Example:

      new MergeJsonWebpackPlugin({
          output: {
              groupBy: [
                  {
                      pattern: '{./node_modules/generic-lib/assets/i18n/en.json,./src/assets/i18n/en.json,./node_modules/specific-lib/src/**/i18n/en.json,./src/app/**/i18n/en.json}',
                      fileName: './assets/i18n/merged-en.json'
                  }
              ]
          },
          globOptions: {
              nosort: true
          }
      })
tettusud commented 6 years ago

Thank you very much for improving the code with your suggetions , am merging the code.

fabgallo commented 6 years ago

Thank you for your quick reply and for considering my pull request!