rails-svelte-inertia-model-configuration

Rails Svelte Inertia Model Configuration

A simple model for you begin your own project using svelte and inertia js in a rails project.

README

This project is a model for you start your rails project with inertia js and svelte.

Choice between fork this project or follow steps below for begin your own project.

Step 1 : Initialize a new rails project with the command rails new my-name-project.

Step 2: Execute the command bundle install.

Step 3: Use the webpacker for install svelte in yout rails project (rails webpacker:install:svelte)

Step 4: Add gem 'inertia_rails' in your GemFile and install client-side adapter from inertia using yarn(yarn add @inertiajs/inertia @inertiajs/inertia-svelte).

Step 5: Run yarn install and bundle install commands.

Step 6: Configure your root router in your routes.rb file.

Step 7: In action corresponding to the root router add the code :

Step 8: Change hello_svelte.js file for svelte_router.js and add this code:

Step 9: In the from application.html.erb add this ruby code:

Step 10: Create your svelte file in javascript/pages folder using the same name from inertia attribute in root action from Step 7. Ex : home.svelte.

Step 11: Add this code in your home.svelte file :

Step 12 : Execute in your main folder project the command rails s --port 3000 for local debug and access address http://localhost:3000 in web browser.

Top categories

Loading Svelte Themes