reactionview 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.
@@ -22,6 +22,11 @@ module ReActionView
22
22
 
23
23
  # Enable debug mode in development (adds debug attributes to HTML)
24
24
  config.debug_mode = Rails.env.development?
25
+
26
+ # Add custom transform visitors to process templates before compilation
27
+ # config.transform_visitors = [
28
+ # Herb::Visitor::new
29
+ # ]
25
30
  end
26
31
  RUBY
27
32
  end
@@ -30,8 +35,8 @@ module ReActionView
30
35
  say "\nReActionView has been successfully installed! 🎉", :green
31
36
  say "\nNext steps:", :blue
32
37
  say " 1. Review config/initializers/reactionview.rb"
33
- say " 2. Enable `config.intercept_erb = true` to process all .html.erb templates using `Herb::Engine`."
34
- say " 3. Create .html.herb templates for explicit Herb usage."
38
+ say " 2. Enable `config.intercept_erb = true` to process all `*.html.erb` templates using `Herb::Engine`."
39
+ say " 3. Create `*.html.herb` templates for explicit Herb usage."
35
40
 
36
41
  say "\nLearn more:", :yellow
37
42
  say " GitHub: https://github.com/marcoroth/reactionview"
@@ -4,10 +4,12 @@ module ReActionView
4
4
  class Config
5
5
  attr_accessor :intercept_erb
6
6
  attr_accessor :debug_mode
7
+ attr_accessor :transform_visitors
7
8
 
8
9
  def initialize
9
10
  @intercept_erb = false
10
11
  @debug_mode = nil
12
+ @transform_visitors = []
11
13
  end
12
14
 
13
15
  def development?
@@ -2,11 +2,24 @@
2
2
 
3
3
  module ReActionView
4
4
  class Railtie < Rails::Railtie
5
+ # If you don't want to precompile ReActionView's assets (eg. because you're using propshaft),
6
+ # you can do this in an initializer:
7
+ #
8
+ # config.after_initialize do
9
+ # config.assets.precompile -= ReActionView::Railtie::PRECOMPILE_ASSETS
10
+ # end
11
+ #
12
+ PRECOMPILE_ASSETS = %w[
13
+ reactionview-dev-tools.esm.js
14
+ reactionview-dev-tools.umd.js
15
+ ].freeze
16
+
5
17
  initializer "reactionview.assets" do |app|
6
18
  if ReActionView.config.development? && app.config.respond_to?(:assets)
7
19
  gem_root = Gem::Specification.find_by_name("reactionview").gem_dir
8
20
 
9
21
  app.config.assets.paths << File.join(gem_root, "app", "assets", "javascripts")
22
+ app.config.assets.precompile += PRECOMPILE_ASSETS
10
23
  end
11
24
  end
12
25
 
@@ -18,7 +31,7 @@ module ReActionView
18
31
 
19
32
  config.after_initialize do
20
33
  ActiveSupport.on_load(:action_view) do
21
- ActionView::Template.register_template_handler :erb, ReActionView::Template::Handlers::Herb if ReActionView.config.intercept_erb
34
+ ActionView::Template.register_template_handler :erb, ReActionView::Template::Handlers::ERB if ReActionView.config.intercept_erb
22
35
  end
23
36
  end
24
37
  end
@@ -13,10 +13,17 @@ module ReActionView
13
13
  filename: template.identifier,
14
14
  project_path: Rails.root.to_s,
15
15
  validation_mode: :overlay,
16
- debug: ::ReActionView.config.debug_mode_enabled?,
17
16
  content_for_head: reactionview_dev_tools_markup(template),
17
+ visitors: ReActionView.config.transform_visitors,
18
18
  }
19
19
 
20
+ if ::ReActionView.config.debug_mode_enabled?
21
+ config[:visitors] << ::Herb::Engine::DebugVisitor.new(
22
+ file_path: template.identifier,
23
+ project_path: Rails.root.to_s
24
+ )
25
+ end
26
+
20
27
  erb_implementation.new(source, config).src
21
28
  end
22
29
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReActionView
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
data/reactionview.gemspec CHANGED
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  spec.add_dependency "actionview", ">= 7.0"
38
- spec.add_dependency "herb", ">= 0.7.0", "< 1.0.0"
38
+ spec.add_dependency "herb", ">= 0.7.5", "< 1.0.0"
39
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactionview
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
  - Marco Roth
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-09-08 00:00:00.000000000 Z
10
+ date: 2025-10-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionview
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.7.0
32
+ version: 0.7.5
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 1.0.0
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.7.0
42
+ version: 0.7.5
43
43
  - - "<"
44
44
  - !ruby/object:Gem::Version
45
45
  version: 1.0.0