diff --git a/README.md b/README.md index f464e55..cb8a172 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ To customize the styleguide, override the style guide layout by adding `mountain ### Custom meta data for stub examples -You can customize the title, description for each example in the stub, as well as the classes that surround the stub example. In order to override the default title, add a `title` key to the `mv_stub_meta` hash. Additional special keys include `description` which will add a description under the title for a given example and `classes` which will add classes for a specific example. +You can customize the title, description for each example in the stub, as well as the classes that surround the stub example. In order to override the default title, add a `title` key to the `mv_stub_meta` hash. Additional special keys include `description` which will add a description under the title for a given example, `classes` which will add classes for a specific example, and `partial` which will allow you to embed the component in a partial (see below for details). E.g: `app/components/card/card.yml` ```yml @@ -256,6 +256,7 @@ E.g: `app/components/card/card.yml` :title: "Specific Example" :description: "Instructions for use case or other UX considerations" :classes: "black-background" + :layout: "card/card_styleguide_layout.html.erb" :title: "Aspen Snowmass" :description: "Aspen Snowmass is a winter resort complex located in Pitkin County in western Colorado in the United States. Owned and operated by the Aspen Skiing Company it comprises four skiing/snowboarding areas on four adjacent mountains in the vicinity of the towns of Aspen and Snowmass Village." :link: "http://google.com" @@ -268,7 +269,11 @@ E.g: `app/components/card/card.yml` :title: "Depth" :number: '71"' ``` +### Wrapping Components in the Style Guide +Sometimes you may want to wrap extra content around the component in the style guide. For example, you may want to include a form tag around a custom form component without including the form tag in the component itself. You can do this by adding the key `partial` in the `mv_stub_meta`. + +To include the component in the partial, you reference `<%= content_for :"#{mv_content_for_name}" %>` ## Improving performance Rendering a large amount of partials in a request can lead to a performance bottleneck, usually this is caused by the parsing and rendering of template code such as ERB or HAML. diff --git a/app/views/mountain_view/styleguide/show.html.erb b/app/views/mountain_view/styleguide/show.html.erb index 6563e7f..41a0e86 100644 --- a/app/views/mountain_view/styleguide/show.html.erb +++ b/app/views/mountain_view/styleguide/show.html.erb @@ -14,7 +14,13 @@