Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

ComponentLibrary::Engine.routes.draw do
mount Lookbook::Engine, at: "/"
end
1 change: 1 addition & 0 deletions lib/component_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "component_library/engine"

require "dry-initializer"
require "lookbook"

module ComponentLibrary
# Your code goes here...
Expand Down
7 changes: 6 additions & 1 deletion lib/component_library/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ class Engine < ::Rails::Engine

config.generators { |g| g.test_framework :rspec }

component_path = root.join("app", "components")
component_path = root.join("app", "components", "component_library")
config.autoload_paths << component_path
config.view_component.preview_paths << component_path

initializer 'lookbook.autoload' do
config.lookbook.project_name = "Component Library"
config.lookbook.preview_paths = [component_path]
end

initializer 'component_library.autoload' do
ActiveSupport.on_load(:view_component) do
# Make it possible to store previews in sidecar folders
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

Rails.application.routes.draw do
mount ComponentLibrary::Engine => "/component_library"
mount ComponentLibrary::Engine => "/"
end