ramda.github.io icon indicating copy to clipboard operation
ramda.github.io copied to clipboard

Consider use of unpkg CDN for REPL libraries

Open MattMS opened this issue 8 years ago • 9 comments

Since there have been reliability issues with the REPL libraries in the past, would it be worthwhile switching over to unpkg?

It has a latest version redirect as well as allowing specific versions.

My understanding of the currently used wzrd.in service is that it performs extra steps to bundle the code, but since the code is already bundled in the repo, maybe it would be quicker to use a straight CDN.

MattMS avatar Nov 29 '16 01:11 MattMS

what wzrd gives up is "browserify as a service" which i believe is required to serve up RF and S which are not bundled for the browser

buzzdecafe avatar Nov 29 '16 18:11 buzzdecafe

Given the benefits of having a browser version in the package, would it be worthwhile adding these to Ramda Fantasy?

I hope @davidchambers doesn't mind me pinging him on his thoughts of adding it to Sanctuary.

MattMS avatar Nov 30 '16 04:11 MattMS

what wzrd gives up is "browserify as a service" which i believe is required to serve up RF and S which are not bundled for the browser

Actually, Sanctuary should run in the browser.

davidchambers avatar Nov 30 '16 11:11 davidchambers

So it would be possible to serve it up with unpkg?

MattMS avatar Nov 30 '16 11:11 MattMS

So it would be possible to serve it up with unpkg?

Yes. I just confirmed that this works:

<script src="https://unpkg.com/[email protected]/dist/ramda.js"></script>
<script src="https://unpkg.com/[email protected]/index.js"></script>
<script src="https://unpkg.com/[email protected]/index.js"></script>

Keep in mind that the Sanctuary module is exported as window.sanctuary, so you may need something like window.S = window.sanctuary; somewhere. :)

davidchambers avatar Nov 30 '16 11:11 davidchambers

in that case we could either bundle RF for the browser or just use S. either is fine with me

buzzdecafe avatar Nov 30 '16 13:11 buzzdecafe

Quickest fix would seem to be adding a prepublish script to run browserify on Ramda-Fantasy. The browser file can be ignored from the Git repo (and that seems to be encouraged).

Rebinding variables for the REPL would be a useful option. I'm not sure if it already does it, although I have seen there seems to be options on what gets exposed, and I guess that is similar.

I haven't looked at the Ramda Fantasy code at all, but I could have a go at hooking up that script if people are keen.

MattMS avatar Nov 30 '16 14:11 MattMS

@MattMS you can reuse or supercede this https://github.com/ramda/ramda-fantasy/pull/129/files

buzzdecafe avatar Nov 30 '16 14:11 buzzdecafe

@buzzdecafe (if I'm not mistaken) it seems that PR only needs the dist files removed and added to .gitignore.

In that case, would it be easier for you to make that change?

MattMS avatar Dec 01 '16 05:12 MattMS