<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<title>Plain HTML Site</title>
<meta content="I don't want to write all this HTML" name='description'>
<meta content='width=device-width' name='viewport'>
</head>
...
gem install middleman
middleman init sample
cd sample
bundle install
bundle exec middleman server
bundle exec middleman build
- source
- javascripts
- example.coffee
- stylesheets
- example.sass
- layouts
- layout.haml
- index.html.erb
- about.md
- build
- javascripts
- example.js
- stylesheets
- example.css
- index.html
- about.html
source/layouts/layout.haml
!!!5
%html
%head
%meta{charset: "utf-8"}
%title= page_title
%meta{name: "description", content: page_description}
...
= stylesheet_link_tag "application"
%body
.fallback-message= partial 'fallback'
= yield
...
= javascript_include_tag "application"
source/helpers/site_helper.rb
module SiteHelpers
def page_title
[data.page.title, "Josh W Lewis"].compact.join(' | ')
end
def page_description
data.page.description || "Slides by Josh W Lewis"
end
def step(id, opts={}, &block)
content_tag :div, id: id, class: :step, data: opts do
capture(&block) if block_given?
end
end
end
source/middleman/index.haml
---
title: Fast Sites with Middleman
published: true
description: Create fast sites fast with your favorite Ruby tools
---
= step "title" do
%h1 Fast Sites with Middleman
%h4
Josh W Lewis
%a{href: "//twitter.com/joshwlewis"} @joshwlewis
%date 5/23/2013
source/_fallback.md
### Your browser doesn't support the features needed to display this presentation.
A simplified version of this presentation follows.
For the best experience, please use one of the following browsers:
- [Chrome](//www.google.com/chrome)
- [Safari](//www.apple.com/safari)
- [Firefox](//www.mozilla.org/firefox)
source/stylesheets/application.sass
@import url(//fonts.googleapis.com/css?family=Droid...
@import "vendor/solarized"
$sansFontFamily: "Droid Sans", "Helvetica Neue"...
$monoFontFamily: "Droid Sans Mono", Monaco...
$baseFontSize: 26px
$baseLineHeight: 38px
@import "bootstrap"
body.impress-supported
.fallback-message
display: none
.step
width: 900px
#title, #middleman, #demo, #meta-outside
text-align: center
source/javascripts/application/tweet.coffee
jQuery ->
$(".tweets").tweet
avatar_size: 48
count: 3
query: "#memtech"
body.impress-supported
.fallback-message
display: none
.step
width: 900px
#title, #middleman, #demo, #meta-outside
text-align: center
body.impress-supported .fallback-message{display:none}body.impress-supported .step{width:850px}body.impress-supported #title,body.impress-supported #middleman,body.impress-supported #demo,body.impress-supported #meta-outside{text-align:center}
What could go wrong?