Skip to content

Instantly share code, notes, and snippets.

@rwarbelow
Created October 12, 2015 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwarbelow/da3ef21480b704305e68 to your computer and use it in GitHub Desktop.
Save rwarbelow/da3ef21480b704305e68 to your computer and use it in GitHub Desktop.
Setting up styling in Sinatra
  • Create a public folder within app. This is where you will store your css, javascripts, and images
  • Create a file application.css within app/public. This is where you will put your custom CSS.
  • Inside app/views, create a file layout.erb. This will automatically render around any other .erb file that you specify to render in your route block. Add the following code to the layout.erb file:
<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="stylesheet" href="/application.css">
  <title>My Sinatra Application</title>
</head>
<body>
  <div class="container">
    <%= yield %>
  </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment