OverZealous / cdnizer

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

Fix matching for more complex inline javascripts #10

Closed christianekstrand closed 9 years ago

christianekstrand commented 9 years ago

The regex was a little bit to hungry and did not match the closing tag if the inlined javascript contained code with src='something'. Added a test and fixed the regex. Please consider for release together with gulp-cdnizer.

OverZealous commented 9 years ago

That change isn't going to work. You removed the ability to have white-space between the <script> tags. (And, in fact, added the ability to have multiple > characters.)

The regex is already non-greedy. However, I think I have a fix that might work for your examples.

OverZealous commented 9 years ago

OK, I replaced the [\s\S] (match anything) with [^>], which should be just as good.

I also pushed an update to gulp-cdnizer, so you should be able to update those to see a fix.

christianekstrand commented 9 years ago

Cool, it works like a charm. Thanks!