← All recipes
Moderne licensed

Update component templateUrl

Recipe IDorg.openrewrite.angular.migration.update-component-template-urlArtifact@openrewrite/recipes-angular

Updates 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-angular

Options

NameTypeDescription
oldTemplateUrlrequiredThe template URL to replace. Can be an exact path (e.g., ./old.html) or a pattern.
e.g. ./old-template.html
newTemplateUrlrequiredThe new template URL to use.
e.g. ./new-template.html
useRegexIf true, treats oldTemplateUrl as a regex pattern and supports capture groups in newTemplateUrl. Default: false
e.g. true