thumblemonks / smurf

Rails plugin to automatically minify JavaScript and CSS when their bundles get cached
http://gusg.us/code/ruby/smurf-rails-autominifying-js-css-plugin.html
MIT License
193 stars 12 forks source link

multiline /*@cc_on \n - raises "Unterminated RegExp Literal" #19

Open zuci42 opened 13 years ago

zuci42 commented 13 years ago

While minimizing some js found an issue:

multilne coniditional comments like

/_@ccon try { if (!window.XMLHttpRequest) document.body.className += ' ie6';} catch(e) {} @/

error ActionView::Template::Error (Unterminated RegExp Literal) (javascript.rb:168) raised after /n char in "/*@cc_on\n"

i see closed issue about cc, but that one covers oneliners only

Regretfully i am still not so tough to fix your code quick. I preffered to use workaround and convert my cc to oneliners already.

Would be cool if someone could manage with that.

BR, & thank for the gem, greatest one as it requires nothing except ruby. no java & no additional tags to use.

peppyheppy commented 12 years ago

hi @zuci, I added the oneliner cc support a while ago. As @matthewrudy mentioned there appears to be a bug with this. One thing that seems strange is that modernizr doesn't have any conditional comments.

Would be happy to accept a pull request.