Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use .html.erb as a file extension for my views with Sinatra?

Tags:

People also ask

How do I view HTML ERB?

View templates HTML tags provide static web pages only but ERB tags give us dynamic information in that HTML template. To view the template file, go to Rails application >> app >> View>> Home folder where the templates files are available.

What is HTML ERB file?

As @Chowlett mentioned before, erb stands for Embedded Ruby. When you define any file as ". html. erb" that means it's an HTML file with ruby code embedded in it and it is similar to ". rhtml" extension of rails file.

What type of file is ERB?

Script written in ERB, a templating language for Ruby; may include any type of plain text or source code, but also includes Ruby ERB code that generates additional text into the resulting file when run with the ERB template engine. ERB is often used for templating Web files such as .


If I have the following Sinatra code:

get '/hi' do
  erb :hello
end

This works great if I have a file called views/hello.erb. However if I have a file called views/hello.html.erb Sinatra can't find the file and gives me an error. How do I tell Sinatra I want it to look for .html.erb as a valid .erb extension?