purifycss-extended icon indicating copy to clipboard operation
purifycss-extended copied to clipboard

Script stop working when it finds a CSS "background-image: url('SVG_encoded');" property

Open HapLifeMan opened this issue 8 years ago • 2 comments

I noticed a bug when purifycss finds something like this in CSS:

.some-property {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");
}

The script stop working and no longer read CSS. I don't know what happened and try to fix that (belongs to original package too)...

HapLifeMan avatar Nov 15 '17 12:11 HapLifeMan

This actually works for me, https://runkit.com/jsnanigans/5a0c36df2daf400012bbf5c6 I tried node 6.12 and 8.9.1

jsnanigans avatar Nov 15 '17 12:11 jsnanigans

Finally it seems that's a problem between dev, production and purifycss:

🔹 npm run dev works fine. 🔹 npm run dev then purifycss works fine. 🔹 npm run production works fine. 🔸 npm run production then purifycss doesn't work.

Very weird 🤔

HapLifeMan avatar Nov 15 '17 13:11 HapLifeMan