vite_rails 1.0.8 → 2.0.0

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -1
  3. data/CONTRIBUTING.md +0 -1
  4. data/README.md +57 -32
  5. data/lib/tasks/vite.rake +17 -0
  6. data/lib/vite_rails.rb +5 -93
  7. data/lib/vite_rails/config.rb +11 -100
  8. data/lib/vite_rails/engine.rb +7 -11
  9. data/lib/vite_rails/installation.rb +47 -0
  10. data/lib/vite_rails/tag_helpers.rb +61 -0
  11. data/lib/vite_rails/version.rb +2 -2
  12. data/{lib/install/config/vite.json → templates/config/rails-vite.json} +1 -0
  13. data/{lib/install/javascript → templates}/entrypoints/application.js +0 -0
  14. metadata +25 -129
  15. data/lib/install/bin/vite +0 -17
  16. data/lib/install/binstubs.rb +0 -6
  17. data/lib/install/config/vite.config.ts +0 -11
  18. data/lib/install/template.rb +0 -40
  19. data/lib/tasks/vite/binstubs.rake +0 -12
  20. data/lib/tasks/vite/build.rake +0 -33
  21. data/lib/tasks/vite/clean.rake +0 -25
  22. data/lib/tasks/vite/clobber.rake +0 -20
  23. data/lib/tasks/vite/info.rake +0 -20
  24. data/lib/tasks/vite/install.rake +0 -12
  25. data/lib/tasks/vite/install_dependencies.rake +0 -20
  26. data/lib/tasks/vite/verify_install.rake +0 -23
  27. data/lib/vite_rails/builder.rb +0 -113
  28. data/lib/vite_rails/commands.rb +0 -68
  29. data/lib/vite_rails/dev_server.rb +0 -23
  30. data/lib/vite_rails/dev_server_proxy.rb +0 -49
  31. data/lib/vite_rails/helper.rb +0 -67
  32. data/lib/vite_rails/manifest.rb +0 -138
  33. data/lib/vite_rails/runner.rb +0 -56
  34. data/package.json +0 -16
  35. data/package/default.vite.json +0 -15
  36. data/test/builder_test.rb +0 -72
  37. data/test/command_test.rb +0 -35
  38. data/test/configuration_test.rb +0 -80
  39. data/test/dev_server_runner_test.rb +0 -83
  40. data/test/dev_server_test.rb +0 -39
  41. data/test/engine_rake_tasks_test.rb +0 -42
  42. data/test/helper_test.rb +0 -138
  43. data/test/manifest_test.rb +0 -75
  44. data/test/mode_test.rb +0 -21
  45. data/test/mounted_app/Rakefile +0 -6
  46. data/test/mounted_app/test/dummy/Rakefile +0 -5
  47. data/test/mounted_app/test/dummy/bin/rails +0 -5
  48. data/test/mounted_app/test/dummy/bin/rake +0 -5
  49. data/test/mounted_app/test/dummy/config.ru +0 -7
  50. data/test/mounted_app/test/dummy/config/application.rb +0 -12
  51. data/test/mounted_app/test/dummy/config/environment.rb +0 -5
  52. data/test/mounted_app/test/dummy/config/vite.json +0 -20
  53. data/test/mounted_app/test/dummy/package.json +0 -7
  54. data/test/rake_tasks_test.rb +0 -74
  55. data/test/test_app/Rakefile +0 -5
  56. data/test/test_app/app/javascript/entrypoints/application.js +0 -2
  57. data/test/test_app/app/javascript/entrypoints/multi_entry.css +0 -4
  58. data/test/test_app/app/javascript/entrypoints/multi_entry.js +0 -4
  59. data/test/test_app/bin/vite +0 -17
  60. data/test/test_app/config.ru +0 -7
  61. data/test/test_app/config/application.rb +0 -13
  62. data/test/test_app/config/environment.rb +0 -6
  63. data/test/test_app/config/vite.json +0 -20
  64. data/test/test_app/config/vite_public_root.yml +0 -20
  65. data/test/test_app/package.json +0 -13
  66. data/test/test_app/public/vite/manifest.json +0 -36
  67. data/test/test_app/some.config.js +0 -0
  68. data/test/test_app/yarn.lock +0 -11
  69. data/test/test_helper.rb +0 -34
  70. data/test/vite_runner_test.rb +0 -59
  71. data/test/webpacker_test.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01d2a1c3a1fb46873e2b8057e91829a74e6c52a010941ec8abe6ca8055242b71
4
- data.tar.gz: 8fbe4d912f70e84631a0131cfc884e4dd547f10105955d6fb1c877d69a22c03c
3
+ metadata.gz: 04dad5363dea685fe1e9e7ad2a852566927bd2804f0dab0ddecc8016da915dd0
4
+ data.tar.gz: 5a8d82f9cfbcf65bef55d28dfdf8cdf5bb77fb04ba83ce9db6b7c4eb2ffb749d
5
5
  SHA512:
6
- metadata.gz: 2807123abe076535c1b5a918d5d6d303b137e1e8025d036692162313ed479500db1fd09ba153e355e33b1a58a9072d19c17b17dc147cd09f841cceffb8d12daa
7
- data.tar.gz: 2200102393275515c8dc4ef981a9676460f27e35d48bba8c906535401aea934b5cd08fddbc19bd61bf7aaaf385c2fc7f27ca99eddca12f2ea364373fb7d2fde0
6
+ metadata.gz: 312c305aa1d69cfb57f93110c093cc7f8b5193a24c16aa5916efc60f8b284d86eba0090aa2e1831748526c7bf57ea6c8962b6d290d469d0ca1b0bdd014888431
7
+ data.tar.gz: d118d7eecbc36163b8ef3789d9198da5c991aab64f6da739381878e7b045c1d365155d22be92226665ce7583f99e0d6d60fd6b01aeb94f5596371a359a242a6d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,30 @@
1
- ## Vite Rails 1.0.8 (2020-01-20)
1
+ ## Vite Rails 2.0.0 (2020-02-09)
2
+
3
+ - Extracted core functionality to `vite_ruby`.
4
+ - User-facing API hasn't really changed, but internal classes have been renamed.
5
+ - Installation script now injects tags to `application.html.erb` if it exists.
6
+
7
+ ## Vite Rails 1.0.12 (2020-01-29)
8
+
9
+ - Add support for Vite 2.0.0-beta.56, which modified the manifest to output a `css` field in the manifest.
10
+ - Start generating an assets manifest, since 2.0.0-beta.51 stopped including non-JS entrypoints in the manifest.
11
+
12
+ ## Vite Rails 1.0.11 (2020-01-24)
13
+
14
+ - Fix bug in `assetHost` that caused `base` to be configured incorrectly.
15
+ - Allow installing `vite` and `vite-plugin-ruby` as devDependencies, and install them when precompiling assets.
16
+ - Move `base` to the configuration root after Vite's update in beta.38
17
+
18
+ ## Vite Rails 1.0.10 (2020-01-23)
19
+
20
+ - Use `path_to_asset` in `vite_asset_path` so that it's prefixed automatically
21
+ when using a CDN (`config.action_controller.asset_host`).
22
+
23
+ ## Vite Rails 1.0.9 (2020-01-22)
24
+
25
+ - Ensure `configPath` and `publicDir` are scoped from `root`, both in Ruby and JS.
26
+
27
+ ## Vite Rails 1.0.8 (2020-01-21)
2
28
 
3
29
  - Change the default of `sourceCodeDir` to `app/frontend`, add instructions for folks migrating
4
30
  from a `app/javascript` structure.
data/CONTRIBUTING.md CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  ```
8
8
  bundle install
9
- yarn
10
9
  ```
11
10
 
12
11
  ## Making sure your changes pass all tests
data/README.md CHANGED
@@ -1,45 +1,70 @@
1
1
  <h1 align="center">
2
- Vite ⚡️ Rails
2
+ <a href="https://vite-ruby.netlify.app/">
3
+ <img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/docs/public/logo.svg" width="120px"/>
4
+ </a>
5
+
6
+ <br>
7
+
8
+ <a href="https://vite-ruby.netlify.app/">
9
+ Vite Rails
10
+ </a>
11
+
12
+ <br>
13
+
3
14
  <p align="center">
4
- <!-- <a href="https://github.com/ElMassimo/vite_rails/actions">
5
- <img alt="Build Status" src="https://github.com/ElMassimo/vite_rails/workflows/build/badge.svg"/>
6
- </a> -->
7
- <!-- <a href="https://codeclimate.com/github/ElMassimo/vite_rails">
8
- <img alt="Maintainability" src="https://codeclimate.com/github/ElMassimo/vite_rails/badges/gpa.svg"/>
15
+ <a href="https://github.com/ElMassimo/vite_ruby/actions">
16
+ <img alt="Build Status" src="https://github.com/ElMassimo/vite_ruby/workflows/build/badge.svg"/>
17
+ </a>
18
+ <a href="https://codeclimate.com/github/ElMassimo/vite_ruby">
19
+ <img alt="Maintainability" src="https://codeclimate.com/github/ElMassimo/vite_ruby/badges/gpa.svg"/>
20
+ </a>
21
+ <a href="https://codeclimate.com/github/ElMassimo/vite_ruby">
22
+ <img alt="Test Coverage" src="https://codeclimate.com/github/ElMassimo/vite_ruby/badges/coverage.svg"/>
9
23
  </a>
10
- <a href="https://codeclimate.com/github/ElMassimo/vite_rails">
11
- <img alt="Test Coverage" src="https://codeclimate.com/github/ElMassimo/vite_rails/badges/coverage.svg"/>
12
- </a> -->
13
24
  <a href="https://rubygems.org/gems/vite_rails">
14
25
  <img alt="Gem Version" src="https://img.shields.io/gem/v/vite_rails.svg?colorB=e9573f"/>
15
26
  </a>
16
- <a href="https://github.com/ElMassimo/vite_rails/blob/master/LICENSE.txt">
27
+ <a href="https://github.com/ElMassimo/vite_ruby/blob/master/LICENSE.txt">
17
28
  <img alt="License" src="https://img.shields.io/badge/license-MIT-428F7E.svg"/>
18
29
  </a>
19
30
  </p>
20
31
  </h1>
21
32
 
22
- [website]: https://vite-rails.netlify.app/
23
- [configuration reference]: https://vite-rails.netlify.app/config/
24
- [features]: https://vite-rails.netlify.app/guide/introduction.html
25
- [guides]: https://vite-rails.netlify.app/guide/
26
- [config]: https://vite-rails.netlify.app/config/
27
- [vite_rails]: https://github.com/ElMassimo/vite_rails
33
+ [website]: https://vite-ruby.netlify.app/
34
+ [configuration reference]: https://vite-ruby.netlify.app/config/
35
+ [features]: https://vite-ruby.netlify.app/guide/introduction.html
36
+ [guides]: https://vite-ruby.netlify.app/guide/
37
+ [config]: https://vite-ruby.netlify.app/config/
38
+ [vite_rails]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_rails
28
39
  [webpacker]: https://github.com/rails/webpacker
29
40
  [vite]: http://vitejs.dev/
30
- [config file]: https://github.com/ElMassimo/vite_rails/blob/main/package/default.vite.json
31
- [example app]: https://github.com/ElMassimo/vite_rails/tree/main/examples/blog
32
- [heroku]: https://vite-rails-demo.herokuapp.com/
33
-
34
- [__Vite Rails__][vite_rails] allows you to use [Vite] to power the frontend of your Rails app.
41
+ [config file]: https://github.com/ElMassimo/vite_ruby/blob/main/vite-plugin-ruby/default.vite.json
42
+ [example app]: https://github.com/ElMassimo/pingcrm-vite
43
+ [heroku]: https://pingcrm-vite.herokuapp.com/
44
+ [Issues]: https://github.com/ElMassimo/vite_ruby/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
45
+ [Discussions]: https://github.com/ElMassimo/vite_ruby/discussions
46
+ [no bundling]: https://vitejs.dev/guide/introduction.html#the-problem
47
+ [bundling]: https://vitejs.dev/guide/introduction.html#why-bundle-for-production
35
48
 
36
49
  [Vite] is to frontend tooling as Ruby to programming, pure joy! 😍
37
50
 
38
- Check an [example app] running on [Heroku].
51
+ [__Vite Rails__][vite_rails] provides a complete setup for Rails applications,
52
+ allowing you to leverage [Vite] to power the frontend of your Rails app.
53
+
54
+ ## Why Vite? 🤔
55
+
56
+ Vite [does not bundle your code during development][no bundling], which means the
57
+ dev server is extremely __fast to start__, and your changes will be __updated instantly__.
58
+
59
+ In production, Vite [bundles your code][bundling]
60
+ with tree-shaking, lazy-loading, and common chunk splitting out of the box, to achieve optimal loading performance.
61
+
62
+ Check [this video comparison with webpack](https://github.com/ElMassimo/pingcrm-vite/pull/1)
63
+ which demonstrates the difference in speed during development.
39
64
 
40
65
  ## Features ⚡️
41
66
 
42
- - 🤖 Automatic entrypoint detection
67
+ - 💡 Instant server start
43
68
  - ⚡️ Blazing fast hot reload
44
69
  - 🚀 Zero-config deployments
45
70
  - 🤝 Integrated with <kbd>assets:precompile</kbd>
@@ -61,7 +86,7 @@ Then, run:
61
86
 
62
87
  ```bash
63
88
  bundle install
64
- bin/rake vite:install
89
+ bundle exec vite install
65
90
  ```
66
91
 
67
92
  This will generate configuration files and a sample setup.
@@ -70,18 +95,18 @@ Additional installation instructions are available in the [documentation website
70
95
 
71
96
  ## Getting Started 💻
72
97
 
73
- Restart your Rails server, and then run <kbd>bin/vite</kbd> to start the Vite development server.
98
+ Restart your Rails server, and then run <kbd>bin/vite dev</kbd> to start the Vite development server.
74
99
 
75
- Add the following your `views/layouts/application.html.erb`:
100
+ Visit any page and you should see a printed console output: `Vite ⚡️ Ruby`.
76
101
 
77
- ```erb
78
- <%= vite_client_tag %>
79
- <%= vite_javascript_tag 'application' %>
80
- ```
102
+ For more [guides] and a full [configuration reference], check the [documentation website][website].
81
103
 
82
- Visit any page and you should see a printed console output: `Vite ⚡️ Rails`.
104
+ ## Contact ✉️
105
+
106
+ Please use [Issues] to report bugs you find, and [Discussions] to make feature requests or get help.
107
+
108
+ Don't hesitate to _⭐️ star the project_ if you find it useful!
83
109
 
84
- For more [guides] and a full [configuration reference], check the [documentation website][website].
85
110
 
86
111
  ## Special Thanks 🙏
87
112
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vite_ruby'
4
+ ViteRuby.install_tasks
5
+
6
+ namespace :vite_rails do
7
+ desc 'Fixes Rails management of node dev dependencies (build dependencies)'
8
+ task :set_node_env do
9
+ ENV['NODE_ENV'] = 'development'
10
+ end
11
+ end
12
+
13
+ # Set NODE_ENV before installation, so that Rails installs JS build dependencies
14
+ # on servers that precompile assets.
15
+ ['yarn:install', 'webpacker:yarn_install'].each do |name|
16
+ Rake::Task[name].enhance([:'vite_rails:set_node_env']) if Rake::Task.task_defined?(name)
17
+ end
data/lib/vite_rails.rb CHANGED
@@ -1,96 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/core_ext/class/attribute_accessors'
3
+ require 'vite_ruby'
5
4
 
6
- require 'zeitwerk'
7
- loader = Zeitwerk::Loader.for_gem
8
- loader.ignore("#{ __dir__ }/install")
9
- loader.ignore("#{ __dir__ }/tasks")
10
- loader.setup
11
-
12
- class ViteRails
13
- # Internal: Prefix used for environment variables that modify the configuration.
14
- ENV_PREFIX = 'VITE_RUBY'
15
-
16
- # Public: Additional environment variables to pass to Vite.
17
- #
18
- # Example:
19
- # ViteRails.env['VITE_RUBY_CONFIG_PATH'] = 'config/alternate_vite.json'
20
- cattr_accessor(:env) { ENV.select { |key, _| key.start_with?(ENV_PREFIX) } }
21
-
22
- cattr_accessor(:logger) { ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) }
23
-
24
- class << self
25
- delegate :config, :builder, :manifest, :commands, :dev_server, :dev_server_running?, to: :instance
26
- delegate :mode, to: :config
27
- delegate :bootstrap, :clean, :clobber, :build, to: :commands
28
-
29
- attr_writer :instance
30
-
31
- def instance
32
- @instance ||= ViteRails.new
33
- end
34
-
35
- def run(args)
36
- $stdout.sync = true
37
- ViteRails::Runner.new(args).run
38
- end
39
-
40
- # Public: The proxy for assets should only run in development mode.
41
- def run_proxy?
42
- config.mode == 'development'
43
- rescue StandardError => error
44
- logger.error("Failed to check mode for Vite: #{ error.message }")
45
- false
46
- end
47
-
48
- def with_node_env(env)
49
- original = ENV['NODE_ENV']
50
- ENV['NODE_ENV'] = env
51
- yield
52
- ensure
53
- ENV['NODE_ENV'] = original
54
- end
55
-
56
- def ensure_log_goes_to_stdout
57
- old_logger = ViteRails.logger
58
- ViteRails.logger = ActiveSupport::Logger.new(STDOUT)
59
- yield
60
- ensure
61
- ViteRails.logger = old_logger
62
- end
63
- end
64
-
65
- # Public: Returns true if the Vite development server is running.
66
- def dev_server_running?
67
- ViteRails.run_proxy? && dev_server.running?
68
- end
69
-
70
- # Public: Current instance configuration for Vite.
71
- def config
72
- @config ||= ViteRails::Config.resolve_config
73
- end
74
-
75
- # Public: Keeps track of watched files and triggers builds as needed.
76
- def builder
77
- @builder ||= ViteRails::Builder.new(self)
78
- end
79
-
80
- # Public: Allows to check if the Vite development server is running.
81
- def dev_server
82
- @dev_server ||= ViteRails::DevServer.new(config)
83
- end
84
-
85
- # Public: Enables looking up assets managed by Vite using name and type.
86
- def manifest
87
- @manifest ||= ViteRails::Manifest.new(self)
88
- end
89
-
90
- # Internal: Helper to run commands related with Vite.
91
- def commands
92
- @commands ||= ViteRails::Commands.new(self)
93
- end
94
- end
95
-
96
- ViteRails::Engine if defined?(Rails)
5
+ require 'vite_rails/version'
6
+ require 'vite_rails/config'
7
+ require 'vite_rails/tag_helpers'
8
+ require 'vite_rails/engine' if defined?(Rails)
@@ -1,104 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Public: Allows to resolve configuration sourced from `config/vite.json` and
4
- # environment variables, combining them with the default options.
5
- class ViteRails::Config
6
- delegate :as_json, :inspect, to: :@config
7
-
8
- def initialize(config)
9
- @config = config.tap { coerce_values(config) }.freeze
10
-
11
- config.each_key do |option|
12
- define_singleton_method(option) { @config[option] }
13
- end
14
- end
15
-
16
- def protocol
17
- https ? 'https' : 'http'
18
- end
19
-
20
- def host_with_port
21
- "#{ host }:#{ port }"
22
- end
23
-
24
- # Internal: Path where Vite outputs the manifest file.
25
- def manifest_path
26
- build_output_dir.join('manifest.json')
27
- end
28
-
29
- # Public: The directory where Vite will store the built assets.
30
- def build_output_dir
31
- public_dir.join(public_output_dir)
32
- end
33
-
34
- private
35
-
36
- # Internal: Coerces all the configuration values, in case they were passed
37
- # as environment variables which are always strings.
38
- def coerce_values(config)
39
- coerce_booleans(config, 'auto_build', 'https')
40
- coerce_paths(config, 'assets_dir', 'build_cache_dir', 'config_path', 'public_dir', 'source_code_dir', 'public_output_dir', 'root')
41
- config['port'] = config['port'].to_i
42
- config['root'] ||= Rails.root
43
- end
44
-
45
- # Internal: Coerces configuration options to boolean.
46
- def coerce_booleans(config, *names)
47
- names.each { |name| config[name] = [true, 'true'].include?(config[name]) }
48
- end
49
-
50
- # Internal: Converts configuration options to pathname.
51
- def coerce_paths(config, *names)
52
- names.each { |name| config[name] = Pathname.new(config[name]) unless config[name].nil? }
53
- end
54
-
55
- class << self
56
- # Public: Returns the project configuration for Vite.
57
- def resolve_config
58
- new DEFAULT_CONFIG.merge(config_from_file).merge(config_from_env)
59
- rescue Errno::ENOENT => error
60
- warn "Check that your vite.json configuration file is available in the load path. #{ error.message }"
61
- new DEFAULT_CONFIG.merge(config_from_env)
62
- end
63
-
64
- private
65
-
66
- # Internal: Used to load a JSON file from the specified path.
67
- def load_json(path)
68
- JSON.parse(File.read(File.expand_path(path))).deep_transform_keys(&:underscore)
69
- end
70
-
71
- # Internal: Retrieves a configuration option from environment variables.
72
- def config_option_from_env(name)
73
- ENV["#{ ViteRails::ENV_PREFIX }_#{ name.upcase }"]
74
- end
75
-
76
- # Internal: Extracts the configuration options provided as env vars.
77
- def config_from_env
78
- CONFIGURABLE_WITH_ENV.each_with_object({}) do |key, env_vars|
79
- if value = config_option_from_env(key)
80
- env_vars[key] = value
81
- end
82
- end.merge(mode: vite_mode)
83
- end
84
-
85
- # Internal: The mode Vite should run on.
86
- def vite_mode
87
- config_option_from_env('mode') || Rails.env.to_s
88
- end
89
-
90
- # Internal: Loads the configuration options provided in a JSON file.
91
- def config_from_file
92
- path = config_option_from_env('config_path') || DEFAULT_CONFIG.fetch('config_path')
93
- multi_env_config = load_json(path)
94
- multi_env_config.fetch('all', {})
95
- .merge(multi_env_config.fetch(vite_mode, {}))
96
- end
3
+ module ViteRails::Config
4
+ # Override: Default values for a Rails application.
5
+ def config_defaults
6
+ require 'rails'
7
+ super(
8
+ asset_host: Rails.application&.config&.action_controller&.asset_host,
9
+ mode: Rails.env.to_s,
10
+ root: Rails.root || Dir.pwd,
11
+ )
97
12
  end
98
-
99
- # Internal: Shared configuration with the Vite plugin for Ruby.
100
- DEFAULT_CONFIG = load_json("#{ __dir__ }/../../package/default.vite.json").freeze
101
-
102
- # Internal: Configuration options that can be provided as env vars.
103
- CONFIGURABLE_WITH_ENV = (DEFAULT_CONFIG.keys + ['root']).freeze
104
13
  end
14
+
15
+ ViteRuby::Config.singleton_class.prepend(ViteRails::Config)
@@ -4,36 +4,32 @@ require 'rails/railtie'
4
4
 
5
5
  class ViteRails::Engine < Rails::Engine
6
6
  initializer 'vite_rails.proxy' do |app|
7
- app.middleware.insert_before 0, ViteRails::DevServerProxy, ssl_verify_none: true if ViteRails.run_proxy?
7
+ app.middleware.insert_before 0, ViteRuby::DevServerProxy, ssl_verify_none: true if ViteRuby.run_proxy?
8
8
  end
9
9
 
10
10
  initializer 'vite_rails.helper' do
11
11
  ActiveSupport.on_load(:action_controller) do
12
- ActionController::Base.helper(ViteRails::Helper)
12
+ ActionController::Base.helper(ViteRails::TagHelpers)
13
13
  end
14
14
 
15
15
  ActiveSupport.on_load(:action_view) do
16
- include ViteRails::Helper
16
+ include ViteRails::TagHelpers
17
17
  end
18
18
  end
19
19
 
20
20
  initializer 'vite_rails.logger' do
21
21
  config.after_initialize do
22
- ViteRails.logger = if ::Rails.logger.respond_to?(:tagged)
23
- ::Rails.logger
24
- else
25
- ActiveSupport::TaggedLogging.new(::Rails.logger)
26
- end
22
+ ViteRuby.instance.logger = Rails.logger
27
23
  end
28
24
  end
29
25
 
30
26
  initializer 'vite_rails.bootstrap' do
31
27
  if defined?(Rails::Server) || defined?(Rails::Console)
32
- ViteRails.bootstrap
28
+ ViteRuby.bootstrap
33
29
  if defined?(Spring)
34
30
  require 'spring/watcher'
35
- Spring.after_fork { ViteRails.bootstrap }
36
- Spring.watch(ViteRails.config.config_path)
31
+ Spring.after_fork { ViteRuby.bootstrap }
32
+ Spring.watch(ViteRuby.config.config_path)
37
33
  end
38
34
  end
39
35
  end