Breezy
main
main
  • README
  • Code of conduct
  • Contributing Guide
  • Changelog
  • Security Policy
  • docs
    • configuration
    • Cross cutting concerns
    • deferments
    • Demo Application
    • Digging
    • Overview
    • Installation
    • NavigationContext
    • The page response
    • Rails utils
    • The store shape
    • Requests
    • Tutorial
    • The return of Rails UJS
    • recipes
      • Infinite scroll
      • Modals
      • progress-bar
      • Shopping cart
      • SPA (Single Page Application) Pagination
      • Server-Side Rendering
      • Replicating Turbo behavior
      • Usage with vite
    • Modules
      • Functions
      • Functions
      • index
      • types.actions
      • types
      • Interfaces
Powered by GitBook
On this page
  • Redux Toolkit
  • Configuration
  • Scaffold

Was this helpful?

  1. docs

Installation

!!! info "Prerequisites" To get started with Superglue, you'll need

- A javascript bundler. We'll assume esbuild with js-bundling, but you can also use vite.
- `yarn`

Add the following to your Gemfile

# Gemfile
gem 'superglue'

Run bundle and the installation generator:

bundle
rails g superglue:install

!!! example "" If you prefer typescript

```terminal
rails g superglue:install --typescript
```

The above will generate the following files:

.
└─ app/
   └─ javascript/
      ├─ slices/
      │  ├─ flash.js
      |  └─ pages.js
      ├─ actions.js
      ├─ application.js
      ├─ application_visit.js
      ├─ page_to_page_mapping.js
      └─ store.js

Redux Toolkit

If you've ever encountered Redux then the files above may seem familiar to you. Superglue works as a complete and fully functional Redux Toolkit application. For the most part, all the functionality you would need resides in these files and you'll make minimum edits, but they are made available if you ever need greater control over state management.

Configuration

We recommend getting familiar with the following files:

  • application_visit.js - Add custom functionality to Superglue navigation, e.g, progress bars.

  • page_to_page_mapping.js - Pairs your props files with your page components.

  • flash.js - Seamlessly, integrates with the Rails flash.

Scaffold

If you'd like to dive right in, you can start with a scaffold:

rails g superglue:scaffold post body:string

!!! example "" If you prefer typescript

```terminal
rails g superglue:scaffold post body:string --typescript
```
PreviousOverviewNextNavigationContext

Last updated 4 months ago

Was this helpful?

For more information, visit the section.

or proceed with a

configuration
tutorial