Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix for incorrect processing of 'rem' in base 64 string #64

wants to merge 2 commits into from

Conversation

philiprenich
Copy link

@philiprenich philiprenich commented Aug 30, 2018

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 in calc() 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 the url() css function). Or don't process the url() function. This is a quicker, simpler fix and I leave a more holistic solution to those with deeper knowledge of this plugin.

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

Successfully merging this pull request may close these issues.

1 participant