From 305d217c39ef33b2e5d3bb97e5a887ed349189c5 Mon Sep 17 00:00:00 2001 From: Brad Gessler Date: Tue, 30 Jan 2024 14:23:04 -0800 Subject: [PATCH] Add header to group basics --- pages/index.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pages/index.md b/pages/index.md index 2b0edd7..efb6caf 100644 --- a/pages/index.md +++ b/pages/index.md @@ -80,16 +80,9 @@ end Your view data, code, and markup live together in the same place making it easier to reason through an application's UI. Since views are just Ruby, you get more flexibility than templating languages like Erb, Slim, Haml, and Liquid. -### What’s a view? -Views are Ruby objects that represent a piece of output from your app. We plan to support various different types of output — such as JSON, XML and SVG — but for now, we’re focusing on HTML. - -Views can have an `initialize` method that dictates which arguments the view accepts and is responsible for setting everything up — usually assigning instance variables for use in the template. - -The template is a special method that’s called when rendering a view. The `template` method determines the output of the view by calling methods that append to the output. - -Instance methods perform important calculations or encapsulate a small part of the template. Public instance methods can expose an interface that’s yielded to the parent when rendering. +# Getting Started -### Installation +## Installation Install Phlex to your project by running: @@ -105,6 +98,15 @@ gem "phlex" and automatically run `bundle install` +## What’s a view? +Views are Ruby objects that represent a piece of output from your app. We plan to support various different types of output — such as JSON, XML and SVG — but for now, we’re focusing on HTML. + +Views can have an `initialize` method that dictates which arguments the view accepts and is responsible for setting everything up — usually assigning instance variables for use in the template. + +The template is a special method that’s called when rendering a view. The `template` method determines the output of the view by calling methods that append to the output. + +Instance methods perform important calculations or encapsulate a small part of the template. Public instance methods can expose an interface that’s yielded to the parent when rendering. + # HTML ## HTML Views You can create an HTML view by subclassing `Phlex::HTML` and defining a `template` instance method.