Sha256: 19d4ae3b7fe938b15ebbe1476a36aad00d6a7a21cfe9418d7dd8722047305212

Contents?: true

Size: 1.9 KB

Versions: 4

Compression:

Stored size: 1.9 KB

Contents

# Alephant::Preview

Provides an in-page preview of components during development

## Installation

Add this line to your application's Gemfile:

    gem 'alephant-preview'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install alephant-preview

## Usage

Provide a view in a folder:

```
└── components
    └── group_name
        ├── models
        │   └── foo.rb
        ├── fixtures
        │   └── foo.json
        └── templates
            └── foo.mustache
```

`alephant-preview`

The included preview server allows you to see the html generated by your
templates, both standalone and in the context of a page.

###Standalone

`/component/:id/?:fixture?`

###Full page preview

`/preview/:group_name/:id/:region/?:fixture?`

`group_name` is the sub_folder that contains your templates

`id` is the component/folder name

`template` is the mustache template file name

`location_in_page` should be something like (for example) `page_head` (specified
within a `preview.mustache` file that the consuming application needs to
create).

- `http://localhost:4567/preview/group_name/id/template/location_in_page`


####Updating preview

`alephant-preview update`

When viewing the component in the context of a page, you'll need to retrieve a
mustache template to provide the page context.

When performing an update a regex is applied to replace the static hostnames in
the retrieved html.

**Environment Variables**

```sh
STATIC_HOST_REGEX="static.(sandbox.dev|int|test|stage|live).yourapp(i)?.com\/"
PREVIEW_TEMPLATE_URL="http://yourapp.com/template"
```

## Contributing

1. Fork it ( http://github.com/<my-github-username>/alephant-preview/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alephant-preview-0.0.5.3 README.md
alephant-preview-0.0.5.2 README.md
alephant-preview-0.0.5.1 README.md
alephant-preview-0.0.3 README.md