These are chat archives for opal/opal

23rd
Mar 2017
Forrest Chang
@fkchang
Mar 23 2017 01:52
@elia do you how to make opal-rails recognize an application.js.rb.erb ? Or whatever equivalent way. I want some opal code to run only in develpment
Mitch VanDuyn
@catmando
Mar 23 2017 11:08
U can certainly do it inside application.js
I.e Foo.rb.erb
Jamie Gaskins
@jgaskins
Mar 23 2017 14:08
@fkchang It shouldn't be hitting Opal while it's in .erb. It should pipe it through ERB first, then output a .rb asset, which then hits Opal.
Forrest Chang
@fkchang
Mar 23 2017 16:33
@catmando @jgaskins I was hoping application.js.rb.erb would "just work", it's possible it might and that I broke something else. I'm at a state now where my application.js.rb won't compile now, so I must've broken something somewhere, unfortunately I can't get a compile error, just a sprockets message saying it can't find application.js
@elia have any tips on how I can hand run an opal command to simulate what opal-rails does?
Forrest Chang
@fkchang
Mar 23 2017 17:34
@/all anyone know how require_tree works? I hand required all the js.rb files to include require_tree on the subdirectories and it works, but going back to require_tree '.' and it won't compile
Mitch VanDuyn
@catmando
Mar 23 2017 17:53
it requires in order all the files in the current directory including the file you are in.
can I ask what the bigger problem you are trying to solve is?
Forrest Chang
@fkchang
Mar 23 2017 18:11
I broke something, application.js won't get compiled
I hand required what I think require_tree does and it works fine, so I have no idea what's broken and I only get a sprockets error that it can't find application.js
Elia Schito
@elia
Mar 23 2017 18:12
@fkchang I think in more recent versions of sprockets extensions cannot be chained arbitrarily anymore, I thinks that's true for sprockets 3+
@fkchang also if you wanna share the application.js contents maybe I can identify the problem

have any tips on how I can hand run an opal command to simulate what opal-rails does?

From rails console you can try: Rails.application.assets['application.js'].to_s

Forrest Chang
@fkchang
Mar 23 2017 19:50
and there's my answer, nevermind
Figured it out, had a bad file in the app/assets/javascripts dir that was not an rb file
Forrest Chang
@fkchang
Mar 23 2017 20:03
And my original assumption is correct application.js.rb.erb does "just work", I just broke my opal stuff in general w/the bad file