I am trying to rewrite a js script in Clojurescript. The JS script is GitHub - jeb5/YouTube-Subscriptions-RSS: Generate an OPML file of RSS feeds for your YouTube subscriptions. Ideally it can be pasted into the browser console. In any case it needs to be run from a particular page logged in as my user . The end result is an opml file (collection of urls for rss reading) extracted from bits of that page DOM.
The first question is how to include Clojurescript as a library from a Javascript place. Every place I go online is the inverse: how to use Javascript stuff from Clojurescript, which I’ve done dozens of times.
How do I use Clojurescript as a package in Javascript?
I think this was an ill posed problem. Although I didn’t state it clearly, I was hoping for a way I could enter ClojureScript into my browser console (on a page rendered to a logged-in user) instead and have it work as well as Javascript. After some research, I don’t think it is possible.
Of course this is possible. The ergonomics are just a bit different. Any “script” you create will essentially bundle the cljs.core
“library” code, which in effect means the script will just be substantially larger than any pure JS script with no dependencies.
For example the script you linked will probably go from ~4KB to >150KB. While it is still totally possible to just paste this into the console it becomes a bit clunky.
Other strategies for this is just building it as a browser extension, or as an external script which you host on the web somewhere and then make a smaller JS script that just downloads that and evals it.
2 Likes