w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to run .erb files in browser with a customized directory?

Are you using a different Ruby framework or need to access server data? If not, you can generate HTML from erb with the command line, then simply open the HTML:

<% # page.erb %>
    <title>My erb</title>
    <h1>it is: <%= Time.now %></h1>

To compile and open from the command line:

$ erb page.erb > page.html
$ open page.html 

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.