Skip to content

holamendi/vite-roda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Vite integration for Roda

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages