Middleman Fragment Caching

A Middleman fragment caching extension like Rails.

Purpose

When we need build many pages, fragment caching can decrease the build time.

Instalation

Add this line on Gemfile:

gem 'middleman-fragment-caching', '~> 1.0'

Run bundler:

$ bundle

Usage

Activate the extension, adding the folling code on config.rb

activate :middleman_fragment_caching

On your app views:

<%= fragment_cache('my_key') do %>
  ... some expensive content
<% end %>

<% fragment_cache('my_key', 'some_version', 123) do %>
  ... other expensive content
<% end %>

Clear all cache:

$ rm -r tmp/cache