Skip to content

Commit

Permalink
fix: remove unnecessary while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
learosema committed Oct 18, 2024
1 parent 5edfb3b commit e02edaf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default (config) => {

return async (data) => {
const includes = new Map();
let content = inputContent, matches;

while ((matches = Array.from(content.matchAll(INCLUDE_REGEX))).length > 0) {
let content = inputContent;
const matches = Array.from(content.matchAll(INCLUDE_REGEX));
if (matches.length > 0) {
for (const [, file] of matches) {
const include = await handleTemplateFile(config, data, path.join(config.dir.includes, file));
includes.set(file, include ? include.content : `<!-- html-include src="${file}" -->`);
Expand Down

0 comments on commit e02edaf

Please sign in to comment.