Skip to content

Instantly share code, notes, and snippets.

@robacarp
Created December 20, 2018 17:37
Show Gist options
  • Save robacarp/926ad19ef839079bd1377afc5dcd5cae to your computer and use it in GitHub Desktop.
Save robacarp/926ad19ef839079bd1377afc5dcd5cae to your computer and use it in GitHub Desktop.
private def d(css_selectors : String, **other_args)
classes = css_selectors.split '.'
if classes[0].starts_with? '#'
id = classes.shift.lstrip '#'
div_args = other_args.merge({ id: id, class: classes.join(" ") })
else
div_args = other_args.merge({ class: classes.join(" ") })
end
div(div_args) do
yield
end
end
def html
body do
d "#vspacer" do
d ".container" do
navbar
d ".row" do
d ".col-md-12 main" do
render_flash
yield
end
end
end
end
d "#footer" do
d ".container" do
hr
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment