-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Which @angular/* package(s) are relevant/related to the feature request?
compiler
Description
Angular templates are currently stored mostly as .html files. In practice, many formatters and tooling ecosystems detect Angular templates using naming conventions such as .component.html.
Since Angular v20 style guidance moved away from strict .component suffix conventions, more projects use no-suffix or simplified file naming. As a result, tools like Prettier, dprint, Biome, and oxfmt often fail to reliably detect Angular template files and apply Angular-aware formatting rules.
This creates inconsistent formatting behavior and forces users into formatter-specific workarounds.
A dedicated Angular template extension (for example .ng) would provide explicit, tool-agnostic identification of template files.
Proposed solution
Introduce support for .ng as a first-class Angular template file extension, alongside .html.
Expected behavior
- Angular compiler and CLI accept
.ngtemplate files fortemplateUrl. - Tooling/documentation formally recognizes
.ngas an Angular template extension. - Existing
.htmltemplates remain fully supported (no breaking change). - Migration can be incremental, project-by-project.
Why this helps
- Removes dependency on filename suffix heuristics (e.g.
.component.html). - Gives formatter authors one clear signal to detect Angular templates.
- Aligns with framework-specific template extensions used elsewhere (e.g.
.vue,.svelte,.astro). - Better reflects that Angular templates are framework templates, not generic HTML documents.
Alternatives considered
-
Keep
.htmland require formatter-specific heuristics/workarounds- Rejected: duplicates effort across each formatter and remains fragile.
-
Enforce/revive
.component.htmlnaming convention- Rejected: conflicts with current naming preferences and does not solve broader tooling ambiguity.
-
Add formatter plugins/rules per ecosystem only
- Rejected: partial, inconsistent ecosystem coverage and ongoing maintenance burden.
-
Add Angular-specific file-level pragma/comments in
.htmlfiles- Rejected: extra boilerplate and still requires every formatter to implement custom parsing behavior.
Formatter issues:
prettier/prettier#18665
g-plane/markup_fmt#209
oxc-project/oxc#17852