No commit activity in last 3 years
No release in over 3 years
Compile different middleman versions with custom data injected in each one
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-versions Compile different middleman site versions with custom data injected in each one

##Dependencies

How to use it

  • Add gem to your Gemfile

    gem 'middleman-versions'
  • Install gems

    bundle install
  • Edit config.rb and add:

    activate :versions do |foo|
      #extension configuration params
    end

Extension params:

Param name Description Type Default value Mandatory
versions_path Directory where we have our data files String versions/ Not
versions List of files that will be treated as versions files Array of: {:path => "name of file", :decorated_name => "name to be showed in interface"} Empty Yes
origin_template Template where will be injected the data readed from files String index.html Not
destination_template Name of final compiled file String index.html Not

Injected variables on Template

Variable name Description Type Example
versions_paths List of all versions final paths Array[String] ["v1/index.html", "v2/index.html"]
versions_list List of all version decorated names Array[String] ["v1","v2"]
version_data Data readed from version file Hash {"license"=>{"name"=>"Apache 2.0", "url"=>"http://www.apache.org/licenses/LICENSE-2.0.html"}}
current_version Current version of page itself String v1
current_path Current final path of page itself String v1/index.html
                                                     |

Compile to static site

When you execute ````middleman build``` you will get a structure like this

build
└─── v1
│    │     index.html
│
└─── v2
|    │    index.html
│
└─── resources
          └─── fonts
          └─── images
          └─── javascripts
          └─── stylesheets

TODO:

  • Example Middleman project using this gem
  • Load all files in versions_path and use file name as decorated_name instead of set versions hash
  • Load subdirectories in versions_path as versions and merge all files inside subdirectory as the same version