Lucky - Instant.Page

Set up Instant.Page in a Lucky Application
Icons/chart bar
Used 58 times
Created by
S Stephen Dolan

Usage
From within a Lucky application with the bloat gem installed, run:
bloat with https://railsbytes.com/script/V33s8k

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

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

Review the code before running this template on your machine.

def add_instant_page_to_layout_head
  inject_into_file "src/components/shared/layout_head.cr", after: /\s+js_link asset\("js\/app.js"\).*\n/ do<<~EOF
  \t\t\tjs_link src: "https://instant.page/5.1.0", type: "module", integrity: "sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw"
  EOF
  end
end

say "Adding `js_link` for Instant.Page to `src/components/shared/layout_head.cr`...", :yellow
add_instant_page_to_layout_head
say "Done.", :green
Comments

Sign up or Login to leave a comment.