I wish the syntax was more like erb i.e. instead of { } although I'm sure someone will explain to me why they can't!
Rux: A JSX-inspired way to render view components in Ruby
11–20 of 42 posts
Re: Rux: A JSX-inspired way to render view components in Ruby
#12Re: Rux: A JSX-inspired way to render view components in Ruby
#13Full circle complete? back at PHP early days
Re: Rux: A JSX-inspired way to render view components in Ruby
#14Re: Rux: A JSX-inspired way to render view components in Ruby
#15Re: Rux: A JSX-inspired way to render view components in Ruby
#16I didn't know about ViewComponent until now, it looks more appealing to me than Rux. Dealing with transpilers is a necessary evil in JS land, I really don't want to bring that headache into my Ruby code.
Re: Rux: A JSX-inspired way to render view components in Ruby
#17You could easily write a method to do this:
def html(&blk)
io = StringIO.new()
builder = Builder::XmlMarkup.new(:target => io, :indent => 2)
blk.call(builder)
io.to_s
end
html do |t|
t.span "#{@first_name} #{@last_name}"
end
Not the prettiest, but it doesn't require additional gems or a new syntax highlighter and linter.Re: Rux: A JSX-inspired way to render view components in Ruby
#18I didn't know about ViewComponent until now, it looks more appealing to me than Rux. Dealing with transpilers is a necessary evil in JS land, I really don't want to bring that headache into my Ruby code.
Re: Rux: A JSX-inspired way to render view components in Ruby
#19[1]: https://github.com/markaby/markaby
Modifying their own example, I kinda like it.
class GreetingComponent
def call
div {
"Hey There" +
NameComponent(first_name: "Homer", last_name: "Simpson")
}
end
endRe: Rux: A JSX-inspired way to render view components in Ruby
#20Hypertext allows you to write HTML from Ruby. https://github.com/soveran/hypertext
rbexy - A Ruby template language inspired by JSX https://github.com/patbenatar/rbexy
imho, hypertext has a great deal of potential especially the DSL.