0.0
No commit activity in last 3 years
No release in over 3 years
Cells support for Middleman.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.0.0
 Project Readme

Middleman::Cells

Gem Version

Cells support for Middleman.

Usage

Create cells under source/cells.

source/cells/greet_cell.rb:

class GreetCell < Cell::ViewModel
  property :name

  def show
    render
  end
end

source/cells/greet/show.erb:

<p>Hello, <%= name %>!</p>

Use it in your views.

source/index.html.erb

---
name: Ninome-chan
---

<%= cell(:greet, current_page.data).() %>

Cool. ๐Ÿ˜

For more details of Cells, see Cells' README.

Installation

Add the following line to your Gemfile.

gem 'middleman-cells'

In addition, you need to install template engine(s) which you want to use in cells. Available engines are listed here.

If you want to use cells-erb, for example, add the following line to Gemfile.

gem 'cells-erb'

Then, run bundle install.

Configuration

require 'cells-erb' # Require template engine(s) you installed.

activate :cells

Or, if you prefer:

activate :cells do
  require 'cells-erb'
end

Configuration Options

cells_dir (default: "cells")

# Change directory where to place cells to `source/view_models`.
activate :cells, cells_dir: 'view_models'

autoload (default: true)

# Disable to autoload cells.
activate :cells, autoload: false

# ...and you need to require your cells manually.
require 'source/cells/foobar_cell'

Contributing

Please report bugs via Issues. Also Pull Requests are welcome. ๐Ÿ˜€

Issue ใ‚„ Pull Request ใฏๆ—ฅๆœฌ่ชžใงใ‚‚OKใงใ™ ๐Ÿ‡ฏ๐Ÿ‡ต

License

MIT