tactivos / grunt-cdn

79 stars 53 forks source link

Consider replacing regexs with actual parsers #33

Open hamtie opened 10 years ago

hamtie commented 10 years ago

Don't know how much time you want to invest in this idea, but the cdn replacements should really be done with proper tokenizers, not regexs.

See this popular stackoverflow post about the issue: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags

This change however would require adding parsers for each html-like template types, like ejs, but presumably those already exist somewhere and maybe could be bootstrapped? Otherwise, this is just going to get gnarly the more formats you try to support.

I might try to help out on this idea when I have more time, but pretty slammed atm. Splitting on elements and replacing the first attribute seems to be working safely now (if you pull my latest request), but I don't really trust it fully.

johnnyhalife commented 10 years ago

Hey @fouasnon,

Thanks for all your contributions, I think that before going any futher with the development we should start working on unit-test for the whole package and then think of improving it.

We reached a point that bugs are introduced and there're many people contributing to this, so let's start adding tests =)