Angular 16, extend builders to perform custom task on compile

60 views Asked by At

I have an Angular 16 app which I compile by ng build <project> --watch. The app is served by external web server (caddy) hence the --watch. So now when I edit any source file, the app is re-compiled, all good so far. However I have some translation files (.properties) that I want to perform additional operation on. In this case to convert the .properties files to json, that is expected by Angular's translation system and store it on disk.

I read that ng <command> things are called builders, part of the angular devkit. However it is not clear to me how can I extend, if possible, the builders, to add additional step (convert to json and store on disk).

Questions:

  • What would be a proper approach to achieve above
  • Should I just create a custom TranslateLoader that will parse the language files. But in this case, every time the app loads, I have to parse the language files, which could be big.
0

There are 0 answers