O'Reilly logo

Jump Start Sinatra by Darren Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2Building a Basic Website

In the last chapter, we installed Sinatra and played around with routes and handlers; however, we only ever sent plain strings back to the client, which, let’s face it, has its limits. In most cases, we’ll want to send HTML pages for the browser to show. As usual, Sinatra makes this really easy to achieve.

In this chapter, we’ll look at using views to send HTML to the browser, and start to build a basic website comprising navigable pages. We’ll use templating languages such as ERB (embedded Ruby) and Slim to produce the HTML, and utilize the CSS preprocessor, Sass, to create a stylesheet to make the site look prettier.

Example Website: Songs By Sinatra

The website we’ll be building is called “Songs By Sinatra,” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required