Project

vite_roda

0.0
No release in over 3 years
Use Vite in Roda with a lean plugin that provides view helpers and dev server proxy.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 2.0
~> 13.0
~> 1.3

Runtime

>= 3.0
~> 3.0
 Project Readme

vite_roda

Vite integration for Roda, built on top of vite_ruby.

Installation

Add to your Gemfile:

gem "vite_roda"

Run:

bundle install
bundle exec vite install

Usage

app.rb

require "roda"
require "vite_roda"

class App < Roda
  plugin :render
  plugin :vite

  route do |r|
    # serve static files (including built vite assets)
    r.public

    r.root do
      view :index
    end
  end
end

views/index.erb

<!DOCTYPE html>
<html>
<head>
  <%= vite_client_tag %>
  <%= vite_javascript_tag "entrypoints/application.js" %>
</head>
<body>
  <h1>Hello, Vite!</h1>
</body>
</html>

View Helpers

  • vite_client_tag - HMR client script (development only)
  • vite_javascript_tag(*names) - Script tags with automatic CSS imports
  • vite_stylesheet_tag(*names) - Stylesheet link tags
  • vite_asset_path(name) - Raw asset path

Configuration

Configuration is handled by vite_ruby via config/vite.json. See the vite_ruby documentation.

Development

bundle install
bundle exec rake # run linter and tests
bundle exec rake test # run tests only
bundle exec rake standard:fix # auto-fix linter issues