In a Kino.JS.Live
module, you can define the “main.js” whether by inserting the JS code as a string in the macro:
asset "main.js" do
"""
export init ...
"""
end
Alternatively, when you run the Livebook locally, you can use a file from the file system and add its path with the option:
use Kino.JS, assets_path: File.cwd()<> "etc"
When you put the Livebook on Github and run it with a badge thats call the code from Github, this will obviously fail.
One way to fetch the JS from Github:
asset "main.js" do
Req.get!("https://...").body
end
Is there is a cleaner or more clever way I missed?
If not, a suggestion could be to add a key like
use Kino.JS, js_url_path: "https://..."
and let the macro do this call?