About Turbo.js

Some of the secret sauce of Forge is in the TurboJS library, a little javascript tool that helps make your sites super snappy. This helper is to help you understand and tackle any issues you might encounter.

What is TurboJS?

TurboJS is a little javascript library. It works its magic by stashing your files in javascript and serving your pages in the background. The result - ridiculously snappy fast sites.

How do I enable and disable it for my sites?

TurboJS Enable / Disable

You can enable / disable TurboJS, which is on by default, in your Forge Site > Settings > TurboJS section.

Recommendation: If your site is already a javascript application, then this is for you. If not, I'd recommend using it!

Automatic Installation

Forge automatically installs Turbo.js at deploy time, so you don't need to manually include it in your projects. This ensures consistent performance optimization across all your Forge sites.

Key Features

Turbo.js offers several powerful features:

Turbo Drive

Accelerates navigation by intercepting link clicks and form submissions:

  • Replaces the current page content without full reloads
  • Updates the browser's address bar and history
  • Maintains scroll position when possible
  • Provides visual feedback during navigation

Turbo Frames

Allows you to update specific parts of a page:

  • Load content into designated frame areas
  • Update forms and content without full page refresh
  • Maintain page state and user interactions
  • Reduce server requests and improve performance

Turbo Streams

Enables real-time updates and dynamic content:

  • Stream updates from the server
  • Update multiple page elements simultaneously
  • Provide real-time feedback for user actions
  • Create interactive, responsive interfaces

Integration with Forge

Forge provides excellent support for Turbo.js:

  • Automatic Turbo.js installation at deploy time
  • Optimized asset delivery for faster loading
  • Built-in support for Turbo Streams
  • Seamless integration with static site generators
  • Easy enable/disable functionality in site settings

Getting Started

To use Turbo.js with your Forge site:

  1. Turbo.js is automatically installed by Forge
  2. Enable/disable in Forge Site > Settings > TurboJS
  3. Add data attributes to your links and forms as needed
  4. Test navigation and user interactions

Best Practices

Follow these best practices when using Turbo.js:

  • Ensure all links work without JavaScript
  • Test navigation with different browsers
  • Provide loading indicators for better UX
  • Handle form submissions properly
  • Consider accessibility implications

Troubleshooting Issues

If you have any issues using it, please get in touch using the Forge support chat in the bottom right corner of the Forge Dashboard.

Join the Discussion

Have questions or want to share your experience? Join our community discussion to connect with other developers and get help from the Forge team.

Visit Forum Discussion