node-pixrem icon indicating copy to clipboard operation
node-pixrem copied to clipboard

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

Open philiprenich opened this issue 7 years ago • 0 comments

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.

philiprenich avatar Aug 30 '18 23:08 philiprenich