phlex-rails-template 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e022001e3e5566f7db0993ffdecfb1882e9f4be95261e3de53f9069b30be35d
4
- data.tar.gz: 76e91257fcea31409418c57a18009113828abf25a15baf8eab60f71d7a9bb57e
3
+ metadata.gz: f5def24c429d94461a6e24684d6a40b774f0d392e0b97990c0894d677870bc45
4
+ data.tar.gz: 85241454ea49450cfbbd9ddc8fe84f185c047ff1266826abb013d8fff72cec4b
5
5
  SHA512:
6
- metadata.gz: b28168c3e642d9e3d69ab2b3344e5f2a7496294ccc74efc712f392e594b279e3e9ee5f416c3ab87fddb69517fa0f5f449b89f63614d7a73892fa8d8f27502dd8
7
- data.tar.gz: 98ef56aed1738586da1915935a2a3f1bd6056853084a329495f7bce32a29899744dac141b95eb695cf89edfd1c13ecee7127d91c53233a483bcdcb5b420693fe
6
+ metadata.gz: a49e3f1e4c369944e40d01b6f657f1af085b3d7f49720ec220149526c8525ee521d06a920df5fe8829a1f572cc2b5dc7756c01b42bc342ea62f75bd6428451b5
7
+ data.tar.gz: 9d615abf91d5862b028b388767b4c2df74acf9a63484b57bd8bb1c75711e8bbe38a66e18c217c186a8b2b04a96029c797d2ba316aafed500faafac4695046c6d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Phlex::Rails::Template
2
2
 
3
- A Rails template handler that lets you write Phlex components directly in `.html.rb` view files.
3
+ A Rails template handler that lets you write Phlex components directly in `.html.phlex` view files.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,10 +13,10 @@ bundle add 'phlex-rails-template'
13
13
 
14
14
  ## Usage
15
15
 
16
- Create view files with the `.html.rb` extension:
16
+ Create view files with the `.html.phlex` extension:
17
17
 
18
18
  ```ruby
19
- # app/views/posts/show.html.rb
19
+ # app/views/posts/show.html.phlex
20
20
  h1 { @post.title }
21
21
 
22
22
  div(class: "content") do
@@ -30,7 +30,7 @@ In your controller:
30
30
  class PostsController < ApplicationController
31
31
  def show
32
32
  @post = Post.find(params[:id])
33
- # Renders app/views/posts/show.html.rb automatically
33
+ # Renders app/views/posts/show.html.phlex automatically
34
34
  end
35
35
  end
36
36
  ```
@@ -43,7 +43,7 @@ You can customize how components are instantiated and how variables are assigned
43
43
 
44
44
  ```ruby
45
45
  # config/initializers/phlex_rails_template.rb
46
- Phlex::Rails::Template.register :rb do
46
+ Phlex::Rails::Template.register :phlex do
47
47
  # Override the base component class
48
48
  def component_class
49
49
  ApplicationComponent
@@ -72,7 +72,7 @@ class CustomConfigurator < Phlex::Rails::Template::Configurator
72
72
  end
73
73
  end
74
74
 
75
- Phlex::Rails::Template.register :rb, CustomConfigurator
75
+ Phlex::Rails::Template.register :phlex, CustomConfigurator
76
76
  ```
77
77
 
78
78
  You can also register additional template handlers with different configurators:
@@ -6,7 +6,7 @@ module Phlex
6
6
  class Engine < ::Rails::Engine
7
7
  initializer "phlex.rails.template.register_handler" do
8
8
  ActiveSupport.on_load(:action_view) do
9
- ActionView::Template.register_template_handler :rb, Phlex::Rails::Template::Handler
9
+ ActionView::Template.register_template_handler :phlex, Phlex::Rails::Template::Handler
10
10
  end
11
11
  end
12
12
  end
@@ -6,9 +6,10 @@ module Phlex
6
6
  class Handler
7
7
  def self.call(template, source = nil)
8
8
  src = source || template.source
9
+ handler_name = template.short_identifier[/\.(\w+)\z/, 1]&.to_sym || :phlex
9
10
 
10
11
  <<~RUBY
11
- __component__ = Phlex::Rails::Template.build(self, :rb) do
12
+ __component__ = Phlex::Rails::Template.build(self, :#{handler_name}) do
12
13
  #{src}
13
14
  end
14
15
  __component__.render_in(self).to_s
@@ -3,7 +3,7 @@
3
3
  module Phlex
4
4
  module Rails
5
5
  module Template
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.3"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-rails-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-11-14 00:00:00.000000000 Z
10
+ date: 2026-01-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: phlex
@@ -51,7 +51,7 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '6.0'
54
- description: Write Phlex components directly in .html.rb view files
54
+ description: Write Phlex components directly in .html.phlex view files
55
55
  email:
56
56
  - bradgessler@gmail.com
57
57
  executables: []