middleman-geo_pattern

Gem Version Build Status Coverage Status Inline docs

This gem integrates the geo_pattern-gem into middleman.

Installation

Add this line to your application's Gemfile:

gem 'middleman-geo_pattern'

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-geo_pattern

Usage

Activate extension

Activate the extension in your config.rb:

activate :geo_pattern

Use helper in view

erb

<%= geo_pattern 'Mastering Markdown' %>

haml

= geo_pattern 'Mastering Markdown'

Define patterns

To configure the patterns which should be used by default, use the .patterns-option - see the README for a list of available patterns.

activate :geo_pattern do |g|
  g.patterns = [:xes]
end

To define them only per invocation, use the patterns-option.

geo_pattern 'Mastering Markdown', patterns: [:xes]

Define color

To configure a default color, use the .default_color-option.

activate :geo_pattern do |g|
  g.color = '#123455'
end

To set it once only, use the color-option.

geo_pattern 'Mastering Markdown', color: '#123456'

Define base color

To configure a default base color, use the .default_base_color-option.

activate :geo_pattern do |g|
  g.base_color = '#123455'
end

To set it once only, use the base_color-option.

geo_pattern 'Mastering Markdown', base_color: '#123456'

Pass a block to the helper

You can also pass a block to geo pattern, to embed some other code within it:

erb

Please mind the missing = in <% geo....

<% geo_pattern('Mastering Markdown') do %>
  <%= content_tag :h1, 'Mastering Markdown' %>
<% end %>

haml

= geo_pattern('Mastering Markdown') do
  = content_tag :h1, 'Mastering Markdown'

Contributing

See CONTRIBUTING.md

(c) 2015, Max Meyer

See LICENSE.txt