Skip to content

Instantly share code, notes, and snippets.

@bhollis
Created December 29, 2015 01:52
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bhollis/bfcdb50aaa2ce600b214 to your computer and use it in GitHub Desktop.
Upgrade to Middleman v4
commit d6b0db2c98cfbee1b3738fa042c89cb0b81fb661
Author: Ben Hollis <ben@benhollis.net>
Date: Mon Dec 28 17:50:43 2015 -0800
Upgrade to Middleman v4
diff --git a/Gemfile b/Gemfile
index 88f7592..990881c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,17 +1,18 @@
source 'http://rubygems.org'
-gem 'middleman-sprockets'#, :path => '/Users/brh/Documents/oss/middleman-sprockets'
-gem 'middleman'#, :path => '/Users/brh/Documents/oss/middleman'
-gem 'middleman-core'#, :path => '/Users/brh/Documents/oss/middleman/middleman-core'
-gem 'middleman-blog'#, :path => '/Users/brh/Documents/oss/middleman-blog'
-gem 'middleman-livereload'#, :path => '/Users/brh/Documents/oss/middleman-livereload'
-gem 'middleman-syntax'#, :path => '/Users/brh/Documents/oss/middleman-syntax'
-gem 'nokogiri'
+gem 'middleman', :path => '/Users/brh/Documents/oss/middleman'
+gem 'middleman-sprockets', '~> 4.0.0.rc'
+gem 'middleman-blog', '~> 4.0'
+gem 'middleman-livereload'
+gem 'middleman-syntax', '~> 2.1'
+gem 'middleman-compass'
+
+gem 'nokogiri' # for blog summaries
gem 'rake'
gem 'builder'
-gem 'fancy-buttons'
+gem 'fancy-buttons', require: false
gem 'modular-scale'
gem 'bootstrap-sass', '~> 3.2.0'
@@ -23,3 +24,5 @@ gem 'redcarpet' # Best markdown
gem 'rb-fsevent'
gem 'ruby-prof'
+
+gem 'pry' # for emacs robe
diff --git a/config.rb b/config.rb
index 0ab12d5..11ef2e1 100644
--- a/config.rb
+++ b/config.rb
@@ -2,6 +2,7 @@
# Compass
###
+require 'compass'
require 'fancy-buttons'
require 'modular-scale'
require 'bootstrap-sass'
@@ -46,10 +47,14 @@ activate :directory_indexes
# Page command
###
-page /404\.html/, :directory_index => false
page "experiments/browserdemos/**.html", :directory_index => false
page "experiments/ie7_tests/**.html", :directory_index => false, :layout => false
-page /google2e26b8cf5034e230\.html/, :directory_index => false
+
+page '404.html', :directory_index => false
+page '**/404.html', :directory_index => false
+
+page 'google2e26b8cf5034e230.html', :directory_index => false
+page '**/google2e26b8cf5034e230.html', :directory_index => false
ignore "/blog/drafts/*"
@@ -57,7 +62,11 @@ ignore "/blog/drafts/*"
# Helpers
###
-set :domain, ''
+helpers do
+ def domain
+ build? ? 'http://benhollis.net' : ''
+ end
+end
activate :syntax
@@ -84,8 +93,5 @@ configure :build do
set :haml, { :ugly => true, :format => :html5 }
- set :domain, 'http://benhollis.net'
-
- activate :asset_host
- set :asset_host, 'http://benhollis.net'
+ activate :asset_host, host: 'http://benhollis.net'
end
diff --git a/source/layouts/article.haml b/source/layouts/article.haml
index da20418..ff798e4 100644
--- a/source/layouts/article.haml
+++ b/source/layouts/article.haml
@@ -1,7 +1,7 @@
- content_for :head do
%meta{ property: "og:description", content: strip_tags(current_article.summary(250)) }
-- wrap_layout :layout do
+= wrap_layout :layout do
%article.single
%header
diff --git a/source/layouts/upgrade.haml b/source/layouts/upgrade.haml
index 39e9c15..45544c0 100644
--- a/source/layouts/upgrade.haml
+++ b/source/layouts/upgrade.haml
@@ -1,12 +1,12 @@
!!! 5
%html(lang="en")
%head
- %title= [data.page.title, "BenHollis.net"].flatten.compact.join(" | ")
+ %title= [current_resource.data.title, "BenHollis.net"].flatten.compact.join(" | ")
= stylesheet_link_tag :global
- - if data.page.favicon
+ - if current_resource.data.favicon
%link(rel="shortcut icon" href="/images/#{@favicon}.png" type="image/png")
%body.upgrade
#upgrade
= yield
-
+
= partial 'analytics'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment