Custom Builds

August 12, 2026 · View on GitHub

Ship only the features you use. The build script generates compile-time boolean constants that let the bundler tree-shake unused code paths entirely.

Feature Flags

CLI NameTypeScript ConstantWhat It Guards
sortingFEATURE_SORTINGColumn sort UI and pipeline sort step
filteringFEATURE_FILTERINGFilter row and pipeline filter step
groupingFEATURE_GROUPINGGroup headers and grouping pipeline
paginationFEATURE_PAGINATIONPagination footer and page slicing
cell-editFEATURE_CELL_EDITInline editing UI and keyboard handlers
expandableFEATURE_EXPANDABLEExpandable detail rows
tree-viewFEATURE_TREE_VIEWTree row rendering and tree pipeline
infinite-scrollFEATURE_INFINITE_SCROLLInfinite scroll state machine
column-movingFEATURE_COLUMN_MOVINGdrag-and-drop on headers
csv-exportFEATURE_CSV_EXPORTCSV export and toolbar button
save-stateFEATURE_SAVE_STATESave/restore state serialization
auto-resizeFEATURE_AUTO_RESIZEResizeObserver integration

Usage

# Full build (default — all features enabled)
node scripts/build-grid.mjs

# Minimal build — only sorting and filtering
node scripts/build-grid.mjs --features sorting,filtering

# Custom locale baked in at build time
node scripts/build-grid.mjs --locale projects/ui-grid/src/lib/grid/i18n/fr-FR.json

# Both features and locale
node scripts/build-grid.mjs --features sorting,filtering,pagination --locale i18n/fr-FR.json

# See available flags
node scripts/build-grid.mjs --list

# Dry run — writes generated file but skips ng build
node scripts/build-grid.mjs --features sorting --dry-run

How It Works

  1. The script backs up grid.features.ts
  2. Generates a new version with only selected flags set to true
  3. Optionally swaps i18n/en-US.json with the provided locale file
  4. Runs ng build uiGridPackage --configuration production
  5. Restores the original files (even on build failure)

The bundler sees if (false) { ... } and tree-shakes the dead code path entirely. The grid API uses noop fallbacks for all optional feature namespaces, so runtime behavior is always safe.

Build Presets

Higher-level presets are available via the preset build script:

# Build the full preset (default)
npm run build:library:preset -- --preset=full

# Build the minimal/headless preset
npm run build:library:preset -- --preset=minimal
PresetIncludesStatus
fullAll features + Angular componentSupported
minimalHeadless core: API, sorting, filtering, paginationSupported
data-heavySorting, filtering, viewport, exportPlanned
interactiveSorting, filtering, grouping, editing, tree, expandablePlanned