These are chat archives for opal/opal

3rd
Apr 2016
Jamie Gaskins
@jgaskins
Apr 03 2016 03:45
@elia: I'm not a fan of that change, tbh. I really like just using .rb — not .js.rb or anything preceding the top-level extension. I understand it's probably just a few files, but it seems weird. I'm not familiar with the Sprockets 4 change, but I'm curious how it would make that transition easier. Got a link?
CJ Lazell
@cj
Apr 03 2016 06:33
evening. in the opal changelog it says you can set Opal.config.unsupported_features_severity but when I try I get NoMethodError: undefined methodconfig' for Opal:Module`
I'm trying to get https://github.com/opal/opal-rspec to work with 0.10.0 :)
Elia Schito
@elia
Apr 03 2016 13:28

@jgaskins .rb is still possible, and .js.rb is already working too. The problem is that in sprockets 4 the internal stuff is different enough to break Opal::Sprockets.load_asset which anyway is a hack. Marking a file with an additional processor vie the added extension will make sprockets add the loading code directly to the js source (the new processor). This helps also because using two separate tags prevents the original script from using async. Hope this is somehow clear, but don't hesitate to ask if clarification is needed.

Anyway the feedback that you prefer not to add extensions is what I was looking for, and makes a point for allowing to set the main assets via a config. :)

@cj stay in touch with @wied03 about opal-rspec, he's constantly keeping it up to date, and I'm quite sure he'll be glad to have your help
as of Opal.config.unsupported_features_severity it's still only in JS land, so you can access it with x-strings: %x{Opal.config.unsupported_features_severity = 'ignore'}, but shouldn't be necessary to adjust its value if you mark the unsupported/missing files as stubbed as they'll be marked as already loaded and any call to require will just return false.
meh.
@meh
Apr 03 2016 14:08
opal/opal-browser#60 opal-browser users and non-users-because-it's-too-big, please provide feedback
CJ Lazell
@cj
Apr 03 2016 21:41
@elia I'm doing this Dir["#{Dir.pwd}/app/test/**/*.rb"].each { |file| Opal::Config.stubbed_files << file } but I still get Cannot handle dynamic require
Martin Becker
@Thermatix
Apr 03 2016 22:05
I thought opal can't do dynamic requires?
CJ Lazell
@cj
Apr 03 2016 22:10
it can't, but if you've already required those files before hand you don't want it to throw an error
Jamie Gaskins
@jgaskins
Apr 03 2016 22:15
@elia: Ah, cool. I don't mind the config option. It's required in Rails anyway if your app's base filename isn't application. :-)
Elia Schito
@elia
Apr 03 2016 22:24
@cj I need more details to be helpful
@jgaskins yeah 🙂
CJ Lazell
@cj
Apr 03 2016 23:19
@elia I'm just going to tackle it a different way. load the contents of the files server side, put the into vars for the client and then eval on tests