4 ms·
I'm making a VDOM framework in Ruby. It runs on the server and streams DOM patches to the browser. Components are written in Haml and stylesheets are scoped to
by quechimba 4y ago
I'm making a VDOM framework in Ruby. It runs on the server and streams DOM patches to the browser. Components are written in Haml and stylesheets are scoped to components. There is hot reloading too.
I haven't made any public releases yet and I'm not sure if the project is mature enough to receive any attention so I'm not posting a link at this point
Example of a simple component:
%div Hello
State and callbacks:
:ruby
Button = import("./Button")
def self.get_initial_state(initial_count: 0, **props) = {
count: 0
}
def handle_click(event)
update do |state|
{ count: state[:count] + 1 }
end
end
%div
%p
Count: #{state[:count]}
%Button(onclick=handle_click)
Increment
And it's async so if you want to make a component that shows the current time:
:ruby
def mount
loop do
update(time: Time.now.to_s)
sleep 0.5
end
end
%p Current time: #{state[:time]}
- ilrwbwrkhv 4y agoLooks super cool.
- evnix 4y agosimilar to livewire in PHP/Laravel and Phoenix liveview, We definitely need more of these as it makes absolutely no sense to bring in the JS bloat for a few forms and drawing a few rectangles and this is 99% of the web apps out there.