require "roda" class App < Roda plugin :render, engine: :phlex route do |r| r.root do render "hello" end end end require "tilt/template" require "phlex" module Tilt class PhlexTemplate < Template def prepare end # def evaluate(scope, locals) # klass = Class.new(Phlex::HTML) # klass.class_eval(data, __FILE__, __LINE__) # klass.new.() # end def precompiled_template(*) data end def precompiled_preamble(*) <<~RUBY klass = Class.new(Phlex::HTML) do RUBY end def precompiled_postamble(*) <<~RUBY end klass.new.call RUBY end end end Tilt.register(Tilt::PhlexTemplate, "phlex")