4

I can't understand how to integrate existing JavaScript libraries into Volt. With Volt 0.9.3 Opal Native object isn't available and use only the backticks with interpolation seems no pratical.

matteofuzz
  • 43
  • 3

1 Answers1

5

You should be able to use native if you want in Volt. Controllers are currently mostly loaded on the client side, but they are required in on the server side for a few reasons, so you need to do:

if RUBY_PLATFORM == 'opal'
  require 'native'
end

Also, did you see these docs? http://docs.voltframework.com/en/getting_help/can_i_use_jquery_or_other_dom_manipulating_js.html

Ryan
  • 956
  • 7
  • 8
  • Hmmm, this contradicts what's mentioned on http://docs.voltframework.com/en/getting_help/what_runs_on_the_client_vs_server.html: "Keep in mind however that this [above code] does not work around `require` since opal does requires at compile time. Which of the two bits of information is correct? – svoop May 16 '16 at 13:03