• Stars
    star
    356
  • Rank 119,446 (Top 3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 12 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy deployment of Middleman sites to Github Pages

Middleman Github Pages

Gem Version Gem Downloads

Middleman makes creating static sites a joy, Github Pages hosts static sites for free, Middleman Github Pages brings the two together. Middleman Github Pages is just a few rake tasks that automate the process of deploying a Middleman site to Github Pages.

Installation

Add this line to your Gemfile:

gem 'middleman-gh-pages'

You'll also need to require the gem in your Rakefile:

require 'middleman-gh-pages'

Usage

Middleman Github Pages provides the following rake tasks:

rake build    # Compile all files into the build directory
rake publish  # Build and publish to Github Pages

The only assumption is that you are deploying to a gh-pages branch in the same remote as the source. rake publish will create this branch for you if it doesn't exist.

Environment Variable Options

ALLOW_DIRTY

You cannot deploy your site if you have uncommitted changes, but you can override this (default: nil):

bundle exec rake publish ALLOW_DIRTY=true

COMMIT_MESSAGE_SUFFIX

You can append a custom suffix to commit messages on the build branch (default: nil):

bundle exec rake publish COMMIT_MESSAGE_SUFFIX="[skip-ci]"

REMOTE_NAME

You can change the remote that you deploy to (default: origin):

bundle exec rake publish REMOTE_NAME=upstream

BRANCH_NAME

If you're publishing a personal or organization page, you may want to use the branch master instead of gh-pages (default: gh-pages):

bundle exec rake publish BRANCH_NAME=master

PROJECT_ROOT

If your middleman project isn't at the root of your repository, you will likely need to change this (default: root of git repository):

bundle exec rake publish PROJECT_ROOT=/Users/me/projects/repo/www

BUILD_DIR

If you override the default middlemant :build_dir setting, you will likely also need to set this variable (default: <PROJECT_ROOT>/build):

bundle exec rake publish BUILD_DIR=/some/custom/path/to/public

Setting ENV variables from your Rakefile

Of course, for more permanent settings, you can always set these environment variables directly in your Rakefile instead of from the command line.

require "middleman-gh-pages"

# Ensure builds are skipped when publishing to the gh-pages branch
ENV["COMMIT_MESSAGE_SUFFIX"] = "[skip ci]"
# Ignore errors about dirty builds (not recommended)
ENV["ALLOW_DIRTY"] = "true"

Custom Domain

To set up a custom domain, you can follow the GitHub help page.

NOTE You will need to put your CNAME file in the source directory of your middleman project, NOT in its root directory. This will result in the CNAME file being in the root of the generated static site in your gh-pages branch.

Project Page Path Issues

Since project pages deploy to a subdirectory, assets and page paths are relative to the organization or user that owns the repo. If you're treating the project pages as a standalone site, you can tell Middleman to generate relative paths for assets and links with these settings in the build configuration in config.rb

activate :relative_assets
set :relative_links, true

NOTE This only affects sites being accessed at the username.github.io/projectname URL, not when accessed at a custom CNAME.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

dieter

Asset pipeline ring middleware
Clojure
134
star
2

vim-config

This is the Vim configuration we use on pairing machines at EdgeCase, as well as many personal machines. It's pretty okay.
Vim Script
68
star
3

pairing-config

Standard box config
Ruby
34
star
4

ghpreview

Preview Markdown files (such as a README) exactly how it will appear on Github
Ruby
27
star
5

spotbox

Official jukebox of the EdgeCase lab
JavaScript
13
star
6

glue.js

Implements Object.watch for javascript objects
JavaScript
12
star
7

ff-om-draggable

A draggable component for OM
Clojure
8
star
8

ECJWT

Implementation of JSON Web Token (JWT)
Objective-C
8
star
9

emacs-config

THIS REPO IS NO LONGER MAINTAINED, PLEASE USE neo/emacs-config
Emacs Lisp
8
star
10

nhs-patientlist

NHS patient list
Ruby
7
star
11

authorize_me

This repo is no longer being supported. See README.
Ruby
6
star
12

people_vs_js

The People vs. JavaScript CodeMash Precompiler Session
JavaScript
4
star
13

Pelotonia

Java
4
star
14

validation_matchers

Ruby
3
star
15

sortable-model

This repo is no longer being supported. See README.
Ruby
3
star
16

styleguide

[Neo Columbus] CSS and HTML style guide
Ruby
3
star
17

cocoa_spotify

Objective-C
3
star
18

raphael_v_canvas

Raphael vs Canvas Demo
JavaScript
2
star
19

movienight

Movie night scheduling application
Ruby
2
star
20

vital_testing

Presentation Materials for the Vital Testing Workshop
Ruby
2
star
21

tdd_ruby_training

Test Driven Introduction to Ruby
Ruby
2
star
22

codemash_mobile_smackdown_2012

This is the "ding, it's done!" version of the app. enjoy!
Objective-C
2
star
23

railsconf_refactoring

Ruby
1
star
24

submission_review2

Ruby
1
star
25

glui.js

Jquery Adapter for Glue.js (https://github.com/edgecase/glue.js)
JavaScript
1
star
26

dieter-ember

Compile handlebars templates in a way compatible with Ember.js
Clojure
1
star
27

ecrails_templates

rails_templates
Ruby
1
star
28

training_slides

Technology Slide Decks
Ruby
1
star
29

teststudio

Ruby
1
star
30

mockdialogue

Ruby
1
star
31

codereviewdialogue

Ruby
1
star
32

presentation_securing_your_rails_app

Slides and Notes for the "Securing your Rails App" presentation
1
star
33

serenade_todomvc

The todomvc app written with Serenade.js
CoffeeScript
1
star
34

modelingdialogue

1
star
35

gmail_campfire_bot

Codebase to read from gmail account and post to campfire.
1
star
36

old_edgecase_blog_redirector

Rack middleware to redirect traffic from the old EC blog to the new one
Ruby
1
star
37

tddscreencast

1
star
38

flamethrower

This repo is no longer being supported. See README.
JavaScript
1
star