Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not All Images Found When On a Single Line #10

Open
jeremy-harnois opened this issue Dec 4, 2020 · 1 comment
Open

Not All Images Found When On a Single Line #10

jeremy-harnois opened this issue Dec 4, 2020 · 1 comment

Comments

@jeremy-harnois
Copy link

In certain situations, images may be listed on a single line (e.g. in a minified HTML file), but only the last image is added to usedImageNames. As a result, images are deleted that are actually in use.

@jeremy-harnois
Copy link
Author

A possible solution that doesn't stray too much from what's already there is to replace lines 46-49 with:

var matches = line.match(/((?:((?:[^\(\\\'\"\r\n\t\f\/\s\.])+)\.(?:(png|gif|jpe?g|pdf|xml|apng|svg|mng)\b)))/gmi) || [];
if (matches.length) {
  usedImageNames.push(...matches);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant