These are chat archives for opal/opal

20th
Jul 2015
Christian Käser
@dfyx
Jul 20 2015 06:00
:+1:
Mitch VanDuyn
@catmando
Jul 20 2015 14:30
@/all something changed from 0.7 to 0.8... I have a very simple example app using sinatra on the server. In 0.8 everything loads up just fine, but none of the Opal code is executed. Its all there, but never run. Did I miss something? Code is here: https://github.com/catprintlabs/react.rb/tree/opal-0.8/example/examples (just a config.ru and a sample .rb file)
meh.
@meh
Jul 20 2015 14:32
catmando, yeah, see meh/lissio@2165cc9
the Opal::Processor part
Mitch VanDuyn
@catmando
Jul 20 2015 15:13
@meh, sorry I am being thick. So I am guessing I have to put
<script>#{Opal::Processor.load_asset_code(@sprockets, source))}</script>
in the html, but what is source in this case? (Note this is straight opal code, no lissio, but I assume that was just an example)
Right now the page looks like this:
    <!doctype html>
    <html>
      <head>
        <title>Hello React</title>
        <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
        <script src="/assets/react-with-addons.min.js"></script>
        <script src="/assets/#{example}.js"></script>
        >----- does this go here???? ----<   <script>#{Opal::Processor.load_asset_code(@sprockets, source))}</script>
      </head>
      <body>
        <div id="content"></div>
      </body>
    </html>
meh.
@meh
Jul 20 2015 15:27
catmando, yes, that should work
Mitch VanDuyn
@catmando
Jul 20 2015 15:37
@meh gee sorry but source is of course not defined... in this context what is "source" going to be???
meh.
@meh
Jul 20 2015 15:42
catmando, right
catmando, let me check
Mitch VanDuyn
@catmando
Jul 20 2015 15:42
I'm getting it I think
looked at load_asset_code, source is the source file name right? and then I need to grab the opal processor
@meh GOT IT! Thanks...
meh.
@meh
Jul 20 2015 15:43
catmando, yeah, source is the file name
catmando, so it knows what the main file to load from the module list is
Mitch VanDuyn
@catmando
Jul 20 2015 15:44
Should this be documented anywhere? I will update the docs, but I am a little unsure where it should go.
meh.
@meh
Jul 20 2015 15:44
catmando, no idea, I had elia work on that stuff because I didn't follow the changes through
as in, to make lissio compatible with 0.8
Mitch VanDuyn
@catmando
Jul 20 2015 15:46
Yeah well that is what happened here too... @elia I would like to update the docs to explain that if you are rolling your own loading function then you need to include a call to Opal::Processor.load_asset_code... its just not clear in the docs where this should go?
Elia Schito
@elia
Jul 20 2015 16:42
good question! I have no idea either, I think I mentioned it in the changelog tho
Mitch VanDuyn
@catmando
Jul 20 2015 17:21
@elia I think perhaps very briefly upfront under install / getting started with a link to a section towards the end with the details. How does that sound?
Elia Schito
@elia
Jul 20 2015 17:23
good, can you draft something for that, super busy for some hours
Ryan Stout
@ryanstout
Jul 20 2015 18:26
@elia you around?
Mitch VanDuyn
@catmando
Jul 20 2015 20:49
arghhh... why is including every, and after so darn hard. Every time I try to use those methods I beat my head on the wall for hours... right now I am including opal-browser in the gem file, but when I require opal-browser it breaks the Opal::Processor.load_asset_code!
THERE!!! the gem file is called opal-browser, but you require browser. Maybe if I said that to myself 37 more times I will remember!