benkeen / grunt-search

Grunt plugin that searches a list of files and logs all findings in various formats.
MIT License
15 stars 8 forks source link

How can we create a custom result file? #11

Closed optyler closed 7 years ago

optyler commented 8 years ago

We use your grunt-search module to search translation key in our source files here is config :

    search: {
      inlineStyles: {
        files: {
          src: ["views/**/*.hbs", "views/*.hbs", "public/javascripts/*.js"]
        },
        options: {
          searchString:/(?:trads|\$\.i18n)\._\((["'])[^\1]*?\1\)/g,
          logFormat: 'json',
          logFile: "./scripts/frontTranslation/translationTestResults.json"
        }
      }
    },

We want logFile contains only the matched strings with some custom search and replace... I saw the customLogFormatCallback but I don't figure out how I can write my custom result in the final file...