Skip to content

low-rb/low_node

Repository files navigation

Gem version

LowNode

LowNodes are the flexible building blocks of your application. They can respond to a route request, or they can be called by another node. They can render a return value, or they can create an event. They are designed to be specific enough to observe events and return values, but generic enough to be split up to represent a complex application with its own patterns and structure. Nodes can render HTML/JSON directly from the Ruby class (via RBX, similar to JSX) and render other nodes into the output using Raindeer's special Antlers syntax; <html><{ ChildNode }></html>.

RBX [UNRELEASED]

Use .rbx as your file extension and now you can place HTML inside of render():

def render
  <html>Content</html>
end

Antlers expressions are also now accepted:

def render
  <html><{ ChildNode }></html>
end

Antlers

Props

def render
  <html><{ UserNode user=@user }></html>
end

Slots

def render
  <html>
    <{ LayoutNode: username=@user.username }>
      <{ UserNode user=@user }>
    <{ :LayoutNode }>
  </html>
end

Conditionals

# Block.
<{ if: @user.happy? }>
  <{ UserNode user=@user }>
<{ :if }>

# Directive.
<{ UserNode user=@user if: @user.happy? }>

Loops

# Block.
<{ for: user in: @users }>
  <{ UserNode user=user }>
<{ :for }>

# Directive.
<{ UserNode user=user for: user in: @users }>

About

Flexible building blocks

Resources

License

Stars

Watchers

Forks

Packages

No packages published