lookbook 0.9.0 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/app/helpers/lookbook/application_helper.rb +1 -1
- data/app/views/lookbook/previews/inputs/_select.html.erb +1 -1
- data/app/views/lookbook/previews/inputs/_text.html.erb +1 -1
- data/app/views/lookbook/previews/inputs/_textarea.html.erb +1 -1
- data/app/views/lookbook/previews/inputs/_toggle.html.erb +1 -1
- data/lib/lookbook/engine.rb +9 -4
- data/lib/lookbook/markdown.rb +1 -0
- data/lib/lookbook/parser.rb +0 -4
- data/lib/lookbook/version.rb +1 -1
- data/lib/tasks/lookbook_tasks.rake +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32c809771b3d81b6622d1624bd3197efb2cc55d825f1543dd444454b18bcd980
|
4
|
+
data.tar.gz: 424739885629f6ca7870322a962934abf80cceb0e849e94ebf9284c093044c6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab5ba4963b759623cbfafdd3270a03f2be2282ffd817466f821dbcc92c36360f72c3766b894b1f1013681392c569479c19263af95bebd1028a0bd2d265117d4a
|
7
|
+
data.tar.gz: db263a69c03239c9865aeb068c31c9ba60e475aa5b685a17128599fe5cba2aa0d4b501047a95e9650191bc57557b896328390c24d821e77eff41f51c8923c075
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ If you'd rather dig in a bit more and run the demo app locally, the [demo repo](
|
|
52
52
|
Add Lookbook to your `Gemfile` somewhere **after** the ViewComponent gem. For example:
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
gem "view_component"
|
55
|
+
gem "view_component"
|
56
56
|
gem "lookbook"
|
57
57
|
```
|
58
58
|
|
@@ -802,6 +802,14 @@ If you wish to add additional paths to listen for changes in, you can use the `l
|
|
802
802
|
config.lookbook.listen_paths << Rails.root.join('app/other/directory')
|
803
803
|
```
|
804
804
|
|
805
|
+
By default Lookbook listens for changes to files with the extensions `rb` and `html.*` (i.e. `.html.erb`).
|
806
|
+
|
807
|
+
You can add additional extensions by using the `listen_extensions` option:
|
808
|
+
|
809
|
+
```ruby
|
810
|
+
config.lookbook.listen_extensions = ['js', 'scss'] # Will not overwrite default extensions
|
811
|
+
```
|
812
|
+
|
805
813
|
### Custom favicon
|
806
814
|
|
807
815
|
If you want to change the favicon used by the Lookbook UI, you can provide a path to your own (or a data-uri string) using the `ui_favicon` option:
|
@@ -11,7 +11,7 @@ module Lookbook
|
|
11
11
|
def landing_path
|
12
12
|
landing = feature_enabled?(:pages) ? Lookbook.pages.find(&:landing) || Lookbook.pages.first : nil
|
13
13
|
if landing.present?
|
14
|
-
|
14
|
+
lookbook_page_path landing.lookup_path
|
15
15
|
else
|
16
16
|
lookbook_home_path
|
17
17
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div x-data="param('<%= name %>', <%= value %>)" data-morph-strategy="replace">
|
1
|
+
<div x-data="param('<%= name %>', <%= j(value) %>)" data-morph-strategy="replace">
|
2
2
|
<button type="button"
|
3
3
|
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-400"
|
4
4
|
:class="{'bg-indigo-500': value, 'bg-gray-300': !value}"
|
data/lib/lookbook/engine.rb
CHANGED
@@ -23,6 +23,7 @@ module Lookbook
|
|
23
23
|
|
24
24
|
config.lookbook = ActiveSupport::OrderedOptions.new
|
25
25
|
config.lookbook.listen_paths ||= []
|
26
|
+
config.lookbook.listen_extensions ||= []
|
26
27
|
config.lookbook.preview_paths ||= []
|
27
28
|
config.lookbook.page_paths ||= ["test/components/docs"]
|
28
29
|
|
@@ -55,6 +56,9 @@ module Lookbook
|
|
55
56
|
options.listen_paths << (vc_options.view_component_path || Rails.root.join("app/components"))
|
56
57
|
options.listen_paths.select! { |path| Dir.exist? path }
|
57
58
|
|
59
|
+
options.listen_extensions += ["rb", "html.*"]
|
60
|
+
options.listen_extensions.uniq!
|
61
|
+
|
58
62
|
options.cable_mount_path ||= "/lookbook-cable"
|
59
63
|
options.cable_logger ||= Rails.logger
|
60
64
|
|
@@ -80,7 +84,7 @@ module Lookbook
|
|
80
84
|
@preview_controller.include(Lookbook::PreviewController)
|
81
85
|
|
82
86
|
if config.lookbook.listen
|
83
|
-
@preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(
|
87
|
+
@preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(#{config.lookbook.listen_extensions.join("|")})$/) do |modified, added, removed|
|
84
88
|
begin
|
85
89
|
parser.parse
|
86
90
|
rescue
|
@@ -126,6 +130,7 @@ module Lookbook
|
|
126
130
|
|
127
131
|
class << self
|
128
132
|
def websocket
|
133
|
+
return @websocket unless @websocket.nil?
|
129
134
|
if config.lookbook.auto_refresh
|
130
135
|
cable = ActionCable::Server::Configuration.new
|
131
136
|
cable.cable = {adapter: "async"}.with_indifferent_access
|
@@ -136,9 +141,9 @@ module Lookbook
|
|
136
141
|
@websocket ||= if Rails.version.to_f >= 6.0
|
137
142
|
ActionCable::Server::Base.new(config: cable)
|
138
143
|
else
|
139
|
-
websocket ||= ActionCable::Server::Base.new
|
140
|
-
websocket.config = cable
|
141
|
-
websocket
|
144
|
+
@websocket ||= ActionCable::Server::Base.new
|
145
|
+
@websocket.config = cable
|
146
|
+
@websocket
|
142
147
|
end
|
143
148
|
end
|
144
149
|
end
|
data/lib/lookbook/markdown.rb
CHANGED
@@ -12,6 +12,7 @@ module Lookbook
|
|
12
12
|
}
|
13
13
|
|
14
14
|
def self.render(text)
|
15
|
+
text&.gsub!("<!-- BEGIN inline template -->", "")&.gsub!("<!-- END inline template -->", "")
|
15
16
|
markdown = Redcarpet::Markdown.new(Renderer, Lookbook.config.markdown_options)
|
16
17
|
markdown.render(text).html_safe
|
17
18
|
end
|
data/lib/lookbook/parser.rb
CHANGED
data/lib/lookbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Perkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|