Turbo Boost Commands

Add turbo_boost-commands to your application
Icons/chart bar
Used 58 times
Created by
J Julian Rubisch

Usage


Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/xkjsbB"
Template Source

Review the code before running this template on your machine.

gem "turbo_boost-commands"
Bundler.with_unbundled_env { run "bundle install" }

run "yarn add @turbo-boost/commands"

inject_into_file "app/javascript/application.js" do <<~EOF
  import "@turbo-boost/commands";
  EOF
end

layout = ask("What is the layout file called you want to add the Turbo Boost meta tag to? (app/views/layouts/application.html.erb")
layout = "app/views/layouts/application.html.erb" if layout.blank?

inject_into_file layout, after: "<%= csrf_meta_tags %>\n" do <<~EOF
  <%= turbo_boost.meta_tag %>
  EOF
end

initializer "turbo_boost.rb" do 
  "# Rails.application.config.turbo_boost_commands[:validate_client_token] = false"
end
Comments

Sign up or Login to leave a comment.