alchaplinsky / polymer-rails

Polymer and web components for Ruby on Rails
MIT License
286 stars 80 forks source link

TypeError: no implicit conversion of nil into String on assets:precompile #79

Open alisnic opened 8 years ago

alisnic commented 8 years ago

Problem is that polymer-rails tries to compile all html found in all gems. If those htmls have any asset links, It will try to compile those as assets.

TypeError: no implicit conversion of nil into String
  (in /Users/andrei/.gem/ruby/2.3.0/gems/rails-assets-bootstrap-daterangepicker-2.0.6/app/assets/templates/bootstrap-daterangepicker/demo.html)
/Users/andrei/.gem/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/base.rb:264:in `initialize'
/Users/andrei/.gem/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/base.rb:264:in `new'
/Users/andrei/.gem/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/base.rb:264:in `find_asset'
/Users/andrei/.gem/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:in `find_asset'
/Users/andrei/.gem/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/environment.rb:75:in `find_asset'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:57:in `find_asset'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:37:in `asset_content'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:29:in `block in inline_styles'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:28:in `each'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:28:in `inline_styles'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/processors/components_processor.rb:6:in `process'
/Users/andrei/.gem/ruby/2.3.0/gems/polymer-rails-1.1.0/lib/polymer-rails/railtie.rb:37:in `block in add_preprocessors_legacy'

Rails 4.2.6, polymer-rails 1.1.0

The obvious fix would be to add return unless asset_path below https://github.com/alchapone/polymer-rails/blob/v1.1.0/lib/polymer-rails/processors/components_processor.rb#L34

Did I get the "fix" right, should I submit a PR?