This repository has been archived by the owner on May 10, 2023. It is now read-only.
Fix for incorrect processing of 'rem' in base 64 string #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a base 64 string has the string 'rem' in it, that rule will be processed (assuming other factors such as browserlist allow it) and duplicated. This fix uses a regex to check the property value rather than a simple
indexOf()
. The regex checks for a value that has a digit followed by 'rem' followed by a space, or a ), or the end of line. The space character and ) are not valid in base 64 and the ) can be used incalc()
functions so it is allowed to process. There is still a small chance that a base64 string could end in a string similar to '3rem' and get processed.It may be wise to never process
background-image
type properties or values inside of quote marks (even though they aren't required in theurl()
css function). Or don't process theurl()
function. This is a quicker, simpler fix and I leave a more holistic solution to those with deeper knowledge of this plugin.