OverZealous / cdnizer

Node module for replacing local links with CDN links, includes fallbacks and customization
MIT License
52 stars 24 forks source link

Excluding absolute url #21

Closed mijikim closed 4 years ago

mijikim commented 8 years ago

Hello, Is there a way for cdnizer to not modify absolute urls? When I run cdnizer on a file that has below url, it removes one of the forward slash.

input < link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />

output < link rel="stylesheet" href="/code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />

Thank you!

OverZealous commented 8 years ago

You just have to be more explicit in your file patterns. The default ones (such as those for the CDN values) are very loose, and will match pretty much anything.

It shouldn't be modifying any URL that is not matched.

mijikim commented 8 years ago

Is there a way to achieve this by ignoring paths that matches certain patterns instead of relying on file patterns? If I have a file that has both absolute path like the one shown above and paths that I would like to be cdnized, then file patterns won't help me that much.

OverZealous commented 8 years ago

Right now there is no support for exclusions. I'm willing to look at a Pull Request, but I don't want to change the default behavior.

thescientist13 commented 5 years ago

A little late to the party but made an attempt at solving this.

OverZealous commented 4 years ago

Thanks @thescientist13! It's published with a new feature flag, excludeAbsolute, under version 3.1.0

I'll probably bump the version on gulp-cdnizer, too

thescientist13 commented 4 years ago

Just tried it out in my project and working great!

Thanks @OverZealous for the help and of course making cdnizer in the first place. 🏆