From e72eb05cc650224f76e36eed068561058d50bbc5 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:15:15 -0400 Subject: [PATCH] refactor(@angular/build): template style elements should always be CSS Now that style elements within templates are processed as inline component styles, the style contents should only be considered CSS. This ensures consistent behavior prior to when style elements were processed. It also ensures that the styles will function as expected in JIT mode where template styles cannot be preprocessed and must be written in a browser supported language. --- .../angular/build/src/tools/esbuild/angular/compiler-plugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts b/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts index a992a199c1cb..62a74062decf 100644 --- a/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts +++ b/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts @@ -185,7 +185,8 @@ export function createCompilerPlugin( stylesheetResult = await stylesheetBundler.bundleInline( data, containingFile, - styleOptions.inlineStyleLanguage, + // Inline stylesheets from a template style element are always CSS + containingFile.endsWith('.html') ? 'css' : styleOptions.inlineStyleLanguage, ); }