Phlex is fun
I love Ruby so much that I write my HTML in Ruby. I’ve got nothing against ERb, but after a year of writing Phlex components, I’m not looking back.
render CodeBlock::Body.new(data: {controller: "snippet-editor"}) do
div(class: "grid-stack") do
render CodeBlock::Code.new(source, language: language, data: {snippet_editor_target: "source"}) do
label(class: "sr-only", for: "snippet[source]") { "Source" }
div(class: "code-editor autogrow-wrapper") do
textarea(
name: "snippet[source]",
data: {snippet_editor_target: "textarea"}
) { source }
end
end
end
end