module RailsVite

Singleton registry for accessing the packs path using a generated manifest. This allows javascript_pack_tag, stylesheet_pack_tag, asset_pack_path to take a reference to, say, “calendar.js” or “calendar.css” and turn it into “/packs/calendar-1016838bab065ae1e314.js” or “/packs/calendar-1016838bab065ae1e314.css”.

When the configuration is set to on-demand compilation, with the ‘compile: true` option in the rails_vite.yml file, any lookups will be preceded by a compilation if one is needed.

Public Instance Methods

ensure_log_goes_to_stdout() { || ... } click to toggle source
# File lib/rails_vite.rb, line 25
def ensure_log_goes_to_stdout
  old_logger = RailsVite.logger
  RailsVite.logger = ActiveSupport::Logger.new(STDOUT)
  yield
ensure
  RailsVite.logger = old_logger
end
instance() click to toggle source
# File lib/rails_vite.rb, line 13
def instance
  @instance ||= RailsVite::Instance.new
end
instance=(instance) click to toggle source
# File lib/rails_vite.rb, line 9
def instance=(instance)
  @instance = instance
end
with_node_env(env) { || ... } click to toggle source
# File lib/rails_vite.rb, line 17
def with_node_env(env)
  original = ENV['NODE_ENV']
  ENV['NODE_ENV'] = env
  yield
ensure
  ENV['NODE_ENV'] = original
end