Repository is archived
No commit activity in last 3 years
No release in over 3 years
Incremental build information for Middleman
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Middleman Build Info

middleman-build-info is an extension for the Middleman static site generator that mantains an incremental build number and date on a JSON file inside your project.

Once the extension is activated It will run and update the build file every time you build your project.

IMAGE

Gem Version Code Climate

Dependencies

  • middleman-core (3.3+)

Installation

Add to your Gemfile and then run bundle install:

gem 'middleman-build-info'

Then activate the extension in your config.rb file:

activate :build_info

Configuration

There are a couple of settings you can override from your config.rb file:

activate :build_info do |option|
  # Name of the build info file (default: 'build.json')
  option.filename = 'build.json'

  # Relative path to build file from MM root (default: '')
  option.relative_path = ''

  # Print build info after a successful build (default: true)
  option.display_info_after_build = true
end

Helper

The build_info helper is available to use in your views. You can pass a key to retrieve a single value or without parameters to retrieve the full hash.

<p class="build-number"><%= build_info(:number) %></p>

It's worth mentioning that:

  • During development this helper will return the information about the current build.
  • During the build process it will return the information about the new build instead.

Upcoming Features

I'm thinking about adding some Git information to the file as well like last commit hash, branch and committer at the time of the build. But I'm open to suggestions and pull requests.

CHANGELOG

License

Copyright (c) 2014 Mariano Cavallo. MIT Licensed, see LICENSE for details.