Hyper is a dead simple, zero-config framework for static HTML websites. Use it to create small HTML sites with static content; host your site anywhere that supports Rack.
Five steps from install to a functioning website:
$ gem install hyper $ hyper new my_website $ cd my_website $ bundle install $ bundle exec shotgun
Point your browser at 0.0.0.0:9292 and you'll see your website's home page.
If you love Heroku, deployment is easy:
$ cd my_website $ heroku create $ git push heroku master
Any other rack-compatible host should work too.
To add content to your site, you just need to know two things:
- Shared content (stuff that goes on every page of your website) goes in
- Page-specific content goes in
Put your navigation and header in
layout.html.erb. Put the content for your about page in
views/about.html.erb (link to the page using
/about). It's that simple.
Also note: your home page content goes in
views/index.html.erb; Hyper knows to map the root URL to that file.
public: Hyper will handle the rest. When referencing these files in your HTML, drop the "public" from the path —
public/images/logo.png should become
<img src="/images/logo.png" />.
Put your custom helper methods in
# in lib/helper.rb module Hyper::Helper def the_time Time.now.to_s end end # in templates/layout.html.erb <html> <head> <title>Clock</title> </head> <body> <h1>Hello! The time is <%= the_time -%></h1> </body> </html>
Helper methods have access to a
request object which is an instance of
Hyper is intentionally simple. Once you've generated a new site, you'll get the following files and folders:
||The layout for your website. Stuff that's the same on every page (header, navigation, etc) should go here|
||This is where your page-specific content lives. See "Adding Content" for more details|
||Put your static assets here|
||Your site's rack config file. Customize your rack app here (if you don't know rack, just ignore this file)|
||For use with Bundler|
Defaults are set so you don't have to worry about anything outside
templates if you don't want to. If you understand rack and want to add middleware, do that in
config.ru — note that Hyper already knows to serve static content from
public, so you don't need to use
I'm James Wilding and I make Ruby and Rails software.
Hyper is released under the MIT license.