Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Easy deployment of Middleman sites to Github Pages

License

NotificationsYou must be signed in to change notification settings

edgecase/middleman-gh-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gem VersionGem Downloads

Middleman makes creating static sites a joy,GithubPages hosts static sites for free, Middleman GithubPages brings the two together. Middleman Github Pages is just a few rake tasksthat 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 directoryrake publish# Build and publish to Github Pages

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

Environment Variable Options

ALLOW_DIRTY

You cannot deploy your site if you have uncommitted changes, but you canoverride 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 thebranchmaster instead ofgh-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 willlikely 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 likelyalso 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 environmentvariables directly in yourRakefile instead of from the command line.

require"middleman-gh-pages"# Ensure builds are skipped when publishing to the gh-pages branchENV["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 theGitHub help page.

NOTE You will need to put your CNAME file in thesource 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 inconfig.rb

activate:relative_assetsset:relative_links,true

NOTE This only affects sites being accessed at theusername.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

About

Easy deployment of Middleman sites to Github Pages

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp