For the complete documentation index, see llms.txt. This page is also available as Markdown.

Optimize

This library provides the following features:

  • AOT translation file flattening

  • Removal of translator comments

  • JSON file minification

Installation

pnpm add @jsverse/transloco-optimize@next --save-dev
yarn add @jsverse/transloco-optimize@next --dev
npm install @jsverse/transloco-optimize@next --save-dev

Usage

  1. Make the optimizer run after building

Create the following task in your project.json configuration file:

{
  "name": "my-app", 
  ...,
  "targets": {
    "transloco:optimize": {
      "command": "transloco-optimize {workspaceRoot}/dist/my-app/assets/i18n"
    }
  }
}

Add the following script to your package.json:

"scripts": {
  "transloco:optimize": "transloco-optimize dist/my-app/assets/i18n",
  "build:prod": "ng build --prod && npm run transloco:optimize"
}
  1. In your Transloco configuration, add the following setting:

Alternatively, if you have some custom pipeline, you can just import it as a function:

Last updated

Was this helpful?