Skip to content

Commit

Permalink
fix(vite-plugin-angular): check for style extension in resourceNameTo…
Browse files Browse the repository at this point in the history
…FileName
  • Loading branch information
joshuamorony committed Feb 5, 2025
1 parent 9924300 commit 70041bc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/vite-plugin-angular/src/lib/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ export function augmentHostWithResources(
const resolvedPath = path.join(path.dirname(containingFile), resourceName);

// All resource names that have template file extensions are assumed to be templates
if (
!options.externalComponentStyles ||
hasTemplateExtension(resolvedPath)
) {
if (!options.externalComponentStyles || !hasStyleExtension(resolvedPath)) {
return resolvedPath;
}

Expand Down Expand Up @@ -301,14 +298,12 @@ export function mergeTransformers(
return result;
}

function hasTemplateExtension(file: string): boolean {
function hasStyleExtension(file: string): boolean {
const extension = path.extname(file).toLowerCase();

switch (extension) {
case '.htm':
case '.html':
case '.svg':
case '.agx':
case '.css':
case '.scss':
return true;
}

Expand Down

0 comments on commit 70041bc

Please sign in to comment.