These are chat archives for opal/opal

16th
Jul 2016
hayley
@hayley
Jul 16 2016 03:29
hey, for those of you who are using Opal to hit json on 3rd party sites where they don't have Access-Control-Allow-Origin: *, how are you handling it? I've generally handled it by finding free proxies (e.g. https://crossorigin.me/) but they seem to disappear/crash quite frequently. And is there an official way to handle jsonp with opal?
Elia Schito
@elia
Jul 16 2016 17:46
@hayley not sure if it's worth it, but maybe creating a middleman-opal gem is easier than the blogpost :)
@hayley wrt jsonp I think jquery has support for it (via $.ajax options), otherwise you can still add functions to window: require 'native'; $$[:callback_123] = -> data { p Hash.new(data) } (don't trust this code 100%, didn't test it)
hayley
@hayley
Jul 16 2016 19:06

@elia I didn't even know that was a possibility until @catmando mentioned that he's apparently working on a reactrb extension for middleman. For me though, after many happy years with middleman, I am shopping around for a new static site generator for a lot of reasons, but one huge one being that there's a bug that prevents me from safely upgrading some of my sites to v4 (and middleman v3 is stuck on opal 0.7.x unless you add something outside of middleman to handle the transpiling).

And yeah, jquery definitely has support for jsonp. And I'll have to look into your sample code. I vaguely remember writing some really hackish coffeescript/jquery thing that would send the jsonp data back to opal.

Elia Schito
@elia
Jul 16 2016 19:32
@hayley during the last update to the opal site I almost rewrote a subset of middleman using actionview, maybe that's a path worth exploring more. The greatest appeal middleman had for was its similarity with rails
Mitch VanDuyn
@catmando
Jul 16 2016 19:49
@elia I'm almost done with reactrb-middleman
It includes reactrb, but will work with poo as well plain old opal
Elia Schito
@elia
Jul 16 2016 19:51
Nice! And LOLS for POO!
hayley
@hayley
Jul 16 2016 22:09
@elia I'm actually one of those 'unicorns' who calls Ruby their programming language of choice but doesn't actually know Rails so I know very little about actionview.
@catmando PlainOldOpal. Hahaha.
hayley
@hayley
Jul 16 2016 22:28

Anyone with experience with opal-webpack, want to take a stab at something I'm attempting? I opened issue cj/opal-webpack#36 but I'm new to the webpack world, so I'm kinda lost as to where to go from here.

In a sentence, I'm trying to integrate reactrb into the react.js-based static site generator gatsby. I just wrote up a bunch of instructions in the README:
https://github.com/hayley/hayley.io

I kinda feel that, given the direction I seem to be headed (writing SPAs), that a static site generator oriented towards doing exactly that kind of site would be the best fit for me going forward. But only if I can get proper opal/reactrb support. Love Opal. Can't stand JS.