Update component templateUrl
Recipe ID
org.openrewrite.angular.migration.update-component-template-urlArtifact@openrewrite/recipes-angularUpdates the templateUrl property value in Angular @Component decorators. Useful for refactoring template file paths or standardizing path conventions.
Single recipeProprietary
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.angular.migration.update-component-template-url --recipe-option "oldTemplateUrl=./old-template.html" --recipe-option "newTemplateUrl=./new-template.html"If the recipe isn’t available locally, install it with:
mod config recipes npm install @openrewrite/recipes-angularOptions
| Name | Type | Description |
|---|---|---|
oldTemplateUrlrequired | | The template URL to replace. Can be an exact path (e.g., ./old.html) or a pattern.e.g. ./old-template.html |
newTemplateUrlrequired | | The new template URL to use. e.g. ./new-template.html |
useRegex | | If true, treats oldTemplateUrl as a regex pattern and supports capture groups in newTemplateUrl. Default: falsee.g. true |