Skip to content

joeldrapper/phlex-sinatra

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phlex Sinatra app

phlex-tweet

This is a short exploration of the Phlex framework using Sinatra. I wanted to play around with Phlex after hearing about it on Remote Ruby.

There isn't much documentation yet, so I hope this will be a simple way for others to get started.

How I did layouts

Not sure if this is how it's intended to be used, but this is what worked for me for layouts:

class LayoutComponent < Phlex::Component
  def template(&)
    body do
      div do
        content(&)
      end
    end
  end
end

class IndexComponent < Phlex::Component
  def template
    h1 "Test!"
  end
end

get '/' do
  LayoutComponent.new.call do |parent|
    parent.render IndexComponent.new
  end
end

How to run

git clone git@github.com:cjavdev/phlex-sinatra.git
cd phlex-sinatra
bundle install
bundle exec rake db:create db:migrate
ruby server.rb

Browse to http://localhost:4567/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%