I'm using Sinatra, and I'm trying to use Slim for the HTML and Stylus for the the CSS.
I'm unsure of what the correct way to do this is. What I've got at the moment works (locally, I've not tried deploying), but I'm wondering if this is the most efficient way of doing things.
My layout.slim file has:
styl:
@import('style')
.. in the head. Is this the best way using Stylus stylesheets, or should I set up a /style path in the sinatra app.rb?
My code is below:
This is my app.rb
require 'sinatra' # ruby url route patterns framework
require 'slim' # html templating
require 'stylus' # css templating
require 'stylus/tilt'
get '/' do
@page_title = "Home"
slim :index
end
In the views folder, I have a layout.slim which looks like this
html
head
title #{@page_title}
styl:
@import('style')
body
#header header in layout.slim
#central-area
== yield
#footer
An index.slim which looks like this
p this is the index which is 'yielded' in the layout.slim
In the same folder as app.rb, I have style.styl:
color-combo1()
color white
background-color red
color-combo2()
color #eeeeee
background-color blue
#header
color-combo1()
padding 5px
width 100%
#central-area
padding 0px 20px
color #111111
#footer
color-combo2()
padding 5px