Overview
Lookbook v2.0 includes a number of improvements and new features, including:
-
Support for previewing a range of component types
-
Preview embeds for including Lookbook previews on external sites
-
Improved file watching/live updates system with tighter Rails integration to improve reliability and interoperability (including support for forking servers in clustered mode)
This release also includes some naming changes (both in documentation and in code) to help clarify concepts such as preview examples/scenarios and to bring Lookbook close in line with other similar tools.
Finally, this documentation site has been rebuilt and the Ruby API docs are now generated using YARD for easier maintence and updates.
The v2.0 release includes a small number of breaking changes. See the upgrade guide for details.
Preview anything*
While Lookbook still works great with ViewComponent, it is now possible to create previews for Phlex views and ActionView partials instead of (or alongside!) any ViewComponent previews.
In fact, Lookbook can create previews of anything that can be rendered using Rails’ render
helper. All previews will have the same functionality available to them
(preview params, display opions etc) no matter what the component type.
See the component docs for more details →
*not quite anything
Preview embeds
Preview embeds allow live component previews to be embedded outside of Lookbook, within the parent app or on an external site.
The following is an example of a full-featured embed of a preview from the Lookbook demo site:
Better file watching
Lookbook’s file watching system has been completely overhauled and is now much more closely integrated with Rails’ own change detection/code reloading system.
This means that some long-standing issues (such as detecting changes on forked servers with multiple processes running) have been resolved
and the listen
and actioncable
gems are now only optional dependencies that can be omitted from production (or entirely!).