Lookbook
The Lookbook application entry point.
Custom Tags
Lookbook.
add_tag
(name, args = nil)
Add a custom tag.
Arguments:
name
|
Symbol,String
|
Tag name |
args
|
Array<Symbol>
|
Array of argument names |
Aliases:
Inspector Panels
Lookbook.
add_panel
(name, partial_path, opts = {})
Add a custom inspector panel.
Arguments:
name
|
Symbol,String
|
Unique panel name |
partial_path
|
String
|
Path to the partial template used to render the panel |
opts
|
Hash
|
Set of panel options |
Options:
label
|
String
|
The text to be displayed in the panel tab |
hotkey
|
String
|
Keyboard shortcut used to switch to the panel |
disabled
|
Boolean
|
Disabled tabs are still accessible but are greyed out in the UI |
copy
|
String
|
If present, the panel will display a copy button that copies the value of this property to the clipboard when clicked |
locals
|
Hash
|
A hash of local variables that will be passed to the panel when it is rendered |
Example:
Lookbook.add_panel(:info, "panels/info", {
label: "Extra Info"
})
Aliases:
Lookbook.
remove_panel
(name)
Remove a panel from the inspector.
Arguments:
name
|
Symbol,String
|
Name of target panel |
Example:
Lookbook.remove_panel(:notes)
Lookbook.
update_panel
(name, opts)
Edit the properties of an existing inspector panel.
Arguments:
name
|
Symbol,String
|
Name of target panel |
opts
|
Hash
|
Set of panel options |
Options:
label
|
String
|
The text to be displayed in the panel tab |
hotkey
|
String
|
Keyboard shortcut used to switch to the panel |
disabled
|
Boolean
|
Disabled tabs are still accessible but are greyed out in the UI |
copy
|
String
|
If present, the panel will display a copy button that copies the value of this property to the clipboard when clicked |
locals
|
Hash
|
A hash of local variables that will be passed to the panel when it is rendered |
Example:
Lookbook.update_panel(:notes, {
label: "Usage Info",
hotkey: "u",
})
Aliases:
Lifecycle Callbacks
Lookbook.
after_change
Add a callback to run when a change to a watched file occurs. Only called when an evented file watcher is being used to detect changes.
Lookbook.
after_initialize
Add a callback to run after app initialization.
Example:
Lookbook.after_initialize do |app|
puts "Lookbook has started!"
end
Lookbook.
before_exit
Add a callback to run before Lookbook shuts down.
Params
Lookbook.
add_input_type
(name, partial_path, opts = {})
Add a custom @param
tag input type.
Arguments:
name
|
Symbol
|
Unique input type name |
partial_path
|
String
|
Path to the partial template used to render the input |
opts
|
Hash
|
Set of default options to be passed to the input. Any supplied param options will override these values |
Aliases:
Other
Lookbook.
config
→ ConfigStore
Provides access to the Lookbook config store.
Example:
Lookbook.config.project_title = "MyApp"
Lookbook.
data
→ Store
Get the global data store instance.
Lookbook.
data=
(new_data)
→ Store
Replace the global data store contents.
Arguments:
new_data
|
Hash
|
Hash of data to store |
Lookbook.
pages
→ Array<PageEntity>
Get an array of documentation page objects.
Lookbook.
previews
→ Array<PreviewEntity>
Get an array of component preview objects.
Lookbook.
version
→ String
Returns the installed Lookbook version.
Example:
<p>Using Lookbook v<%= Lookbook.version %></p>