Skip to content

Commit

Permalink
fix: add missing script to regex in resolveRelativePathsLevel
Browse files Browse the repository at this point in the history
fixes #129
  • Loading branch information
yassinedoghri committed Mar 9, 2023
1 parent 16cd87e commit 9288efe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/cli/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ describe("resolveRelativePathsLevel(...)", () => {
},
{
name: "with relative src pattern",
actual: `<src="../path/to/script"></script>`,
expected: `<src="../../path/to/script"></script>`,
actual: `<script src="../path/to/script"></script>`,
expected: `<script src="../../path/to/script"></script>`,
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const resolveRelativePathsLevel = (
`${before}${addDepthToRelativePath(relativePath, fileDepth)}${after}`
);
fileContents = fileContents.replace(
/(<src=["'])(\..*)(["'])/g,
/(<script\s+src=["'])(\..*)(["'])/g,
(_, before, relativePath, after) =>
`${before}${addDepthToRelativePath(relativePath, fileDepth)}${after}`
);
Expand Down

0 comments on commit 9288efe

Please sign in to comment.