Skip to content

aymericzip/intlayer-skills / skills/intlayer-usage

intlayer-usage

Verified

Provides general guidelines for using Intlayer in any project. Use when the user asks to "get started with Intlayer", "declare content files", or understand the "project structure" for internationalization.

FileKindSize
LICENCE.mdmarkdown10.7 KB
SKILL.mdskill md3.6 KB
references/concept_how-works-intlayer.mdmarkdown28.7 KB
references/concept_per-locale-file.mdmarkdown7.6 KB
references/get-started.mdmarkdown26.6 KB
references/packages_intlayer_comparePaths.mdmarkdown5.0 KB
references/packages_intlayer_exports.mdmarkdown12.4 KB
references/packages_intlayer_getCanonicalPath.mdmarkdown3.4 KB
references/packages_intlayer_getConfiguration.mdmarkdown4.1 KB
references/packages_intlayer_getDictionary.mdmarkdown4.9 KB
references/packages_intlayer_getDictionaryAsync.mdmarkdown6.3 KB
references/packages_intlayer_getEnumeration.mdmarkdown3.3 KB
references/packages_intlayer_getHTMLTextDir.mdmarkdown2.3 KB
references/packages_intlayer_getIntlayer.mdmarkdown8.7 KB
references/packages_intlayer_getIntlayerAsync.mdmarkdown6.8 KB
references/packages_intlayer_getLocale.mdmarkdown1.1 KB
references/packages_intlayer_getLocaleLang.mdmarkdown1.9 KB
references/packages_intlayer_getLocaleName.mdmarkdown3.5 KB
references/packages_intlayer_getLocalizedPath.mdmarkdown6.8 KB
references/packages_intlayer_getLocalizedUrl.mdmarkdown9.3 KB
references/packages_intlayer_getMultilingualUrls.mdmarkdown8.7 KB
references/packages_intlayer_getPathWithoutLocale.mdmarkdown1.6 KB
references/packages_intlayer_getPrefix.mdmarkdown6.0 KB
references/packages_intlayer_getTranslation.mdmarkdown3.4 KB
references/packages_intlayer_validatePrefix.mdmarkdown1.0 KB
references/packages_react-intlayer_exports.mdmarkdown13.7 KB
references/packages_vite-intlayer_exports.mdmarkdown6.0 KB
references/packages_vite-intlayer_intlayer.mdmarkdown6.0 KB
references/packages_vite-intlayer_intlayerCompiler.mdmarkdown4.2 KB
references/packages_vite-intlayer_intlayerMinify.mdmarkdown3.9 KB
references/packages_vite-intlayer_intlayerProxy.mdmarkdown7.0 KB
references/packages_vite-intlayer_intlayerPrune.mdmarkdown4.7 KB
references/why.mdmarkdown58.2 KB

references/packages_vite-intlayer_intlayerMinify.md

View on GitHub
---
createdAt: 2026-06-25
updatedAt: 2026-06-25
priority: 5
title: intlayerMinify Vite Plugin Documentation | vite-intlayer
description: Vite plugin that minifies compiled Intlayer dictionary JSON files and optionally mangles content field names to reduce bundle size.
keywords:
  - intlayerMinify
  - vite
  - plugin
  - minify
  - bundle size
  - dictionary
  - internationalization
  - i18n
slugs:
  - doc
  - packages
  - vite-intlayer
  - intlayerMinify
history:
  - version: 9.0.0
    date: 2026-06-25
    changes: "Init doc"
author: aymericzip
---

# intlayerMinify

`intlayerMinify` is a Vite plugin that minifies compiled dictionary JSON files during a production build. It strips all unnecessary whitespace and, when combined with `intlayerPrune`, optionally renames content field names to short alphabetic aliases (`a`, `b`, `c`, …) to further reduce bundle size.

> The plugin is already included and configured automatically when you use [`intlayer()`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/vite-intlayer/intlayer.md). You only need to register it manually if you are composing the plugin stack yourself.

- [`intlayer()`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/vite-intlayer/intlayer.md)

## Usage

```ts
// vite.config.ts
import { defineConfig } from "vite";
import { intlayerMinify, intlayerPrune } from "vite-intlayer";
import { createPruneContext } from "@intlayer/babel";

const pruneContext = createPruneContext();

export default defineConfig({
  plugins: [
    intlayerPrune(intlayerConfig, pruneContext),
    intlayerMinify(intlayerConfig, pruneContext),
  ],
});
```

## Activation conditions

`intlayerMinify` is active **only** when all three of the following are true:

1. The Vite command is `build` (not `serve` / dev).
2. `build.optimize` is `true` (or `undefined`, which defaults to `true` for builds).
3. `build.minify` is `true` in your Intlayer config.

When `editor.enabled` is `true`, the plugin still runs but **skips field renaming**: renaming rewrites the content keys the interpreter walks, so the `keyPath` the visual editor receives would no longer match the unmerged dictionaries it edits. Whitespace compaction and the top-level metadata strip stay active.

## What gets minified

The plugin targets two dictionary locations (as resolved from `intlayer.system`):

- `dictionariesDir`: static all-locale dictionaries (e.g. `.intlayer/dictionaries/*.json`)
- `dynamicDictionariesDir`: per-locale dynamic dictionaries

> Fetch-mode dictionaries (`fetchDictionariesDir`) are **never** minified because they are served from a remote API at runtime using their original field names. Renaming fields would create a mismatch between the server response and client-side property accesses.

## Field-name mangling (property minification)

When `intlayerPrune` has analysed the codebase and populated `pruneContext.dictionaryKeyToFieldRenameMap`, `intlayerMinify` also renames content field names to short aliases. For example:

```jsonc
// before
{ "key": "myDict", "content": { "title": "Hello", "description": "World" } }

// after (with mangling)
{ "key": "myDict", "content": { "a": "Hello", "b": "World" } }
```

The corresponding source-file property accesses are renamed by the Babel pass inside `intlayerOptimize`, so runtime behaviour is unchanged.

Internal Intlayer fields (`nodeType`, `translation`, etc.) are never renamed.

## Edge-case dictionaries

Dictionaries flagged in `pruneContext.dictionariesWithEdgeCases` (structural anomalies detected during the prune phase) are skipped entirely, neither minified nor mangled, to avoid shipping broken data.

## Qualified groups (collections / variants / meta records)

For dictionaries with a `qualifierTypes` array (collections, variants, and meta records), the plugin preserves the `qualifierTypes` array and the `meta` side-map verbatim. Only the `content` entries have their field names mangled. The composite keys (used for selector matching at runtime) are never touched.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall