Conversation
|
Thank you for the PR :) |
|
If it's compatible with Vue, then it should work with vitepress? It would be nice to test that. |
Well, Vitepress does the complete building from start to end in their pipeline, so that's different from using a specific JS library like Vue inside Bonito and letting Bonito handle everything. |
|
What you want for Vitepress is a Bonito integration into Vitepress, not Vue integration into Bonito ;) |
It indeed is very easy to convert the HTML file to Julia, but maintaining it will get harder, since it can get pretty messy for bigger projects. Furthermore, writing actual HTML rather than HTML in Julia feels more natural and makes splitting work easier. |
Hello,
I find it quite convenient to decouple HTML and JavaScript from Julia, so I have made a proof of concept PR.
This makes it easier to create bigger and well designed frontends using UI coponent libraries, CSS libaries or even whole frameworks like Vue while keeping the core functionality in Julia.
This PR adds the functionality to write HTML code in
index.html, JS code in JS files, place Bonito plots inindex.htmland expose observables towindow.observables, using Bonito's WebSockets to update observables.An example using this PR can be found on https://github.com/Niels1006/exBonito, using custom HTML components to change observables:

This is what a snippet of a Bonito app looks like:
In this snippet, plots get created that depend on observables that then get exposed to
window.observables. Furthermore,index.htmlandscript.jsget injected into thedocument.index.htmlis just a regular html file. Note, thatscriptsorstylesheetscan be included in theheadas usual, because theheadofindex.htmlgets appended todocument.head. Important here is the creation of thedivswithid=plot-*, because the Bonito plots get placed in these:To now make those sliders use the observables defined in Julia, JS can be used:
What do you think about the idea? The approach can be changed, right now it's just a proof of concept.