tactivos / grunt-cdn

79 stars 53 forks source link

SVG styles in CSS files break Job._replace #52

Open arvidkahl opened 10 years ago

arvidkahl commented 10 years ago

SVG-related styles like behavior:url("#default#VML"), while being obnoxious and odd in themselves, break the Job.prototype._replace method by yielding a null value for resourceUrl.pathname in the url.parse call.

I tried using options.match to circumvent the plugin from crashing, but it was trying to match on an undefined value. So I changed job.js:87 to

if (!resourceUrl.pathname || !resourceUrl.pathname.match(options.match)) { ...

This is a hack, however. There is probably a better place for a sanity check like this, since this only works if options.match is being used.

I work with SVG styles since I am using the leaflet library and some addons there have their own (weird little) SVG styles which I concatenate into my CDN css.

johnnyhalife commented 10 years ago

Can you send a PR?

On Sun, Mar 16, 2014 at 12:08 PM, Arvid Kahl notifications@github.comwrote:

SVG-related styles like behavior:url("#default#VML"), while being obnoxious and odd in themselves, break the Job.prototype._replace method by yielding a null value for resourceUrl.pathname in the url.parse call.

I tried using options.match to circumvent the plugin from crashing, but it was trying to match on an undefined value. So I changed job.js:87 to

if (!resourceUrl.pathname || !resourceUrl.pathname.match(options.match)) { ...

This is a hack, however. There is probably a better place for a sanity check like this, since this only works if options.match is being used.

I work with SVG styles since I am using the leaflet library and some addons there have their own (weird little) SVG styles which I concatenate into my CDN css.

— Reply to this email directly or view it on GitHubhttps://github.com/tactivos/grunt-cdn/issues/52 .