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

Modernizr minify causes "Unterminated RegExp Literal" error. #20

Open matthewrudy opened 12 years ago

matthewrudy commented 12 years ago

Not sure if this is the same issue as #19, but Modernizr is a popular enough project that this seems to be a real problem.

require 'open-uri'
require 'smurf'

modernizr = open("https://raw.github.com/Modernizr/Modernizr/master/modernizr.js")

Smurf::Javascript.new(modernizr.read)

# RuntimeError: Unterminated RegExp Literal
# from ~/.rvm/gems/ruby-1.9.3-p0@global/gems/smurf-1.0.8/lib/smurf/javascript.rb:168:in `action'
matthewrudy commented 12 years ago

note: I fixed this for myself, by building a minified version of modernizr (I then minify it again with smurf)

This would support the idea that its something to do with the comments?

peppyheppy commented 12 years ago

Hi @matthewrudy, thanks for reporting the issue. Based on your test it could very well be a problem with the comments. Feel free to fork and submit a pull request if you have the time. Thanks.