Sha256: 63e18e4a513a5d5a7c1bbb43f0c8b3f25a34ab33e1dcbdbdff6dde426926415c

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")

HIDE_ON_MOBILE_STYLE = <<-HTML.chomp
    <% if turbo_native_app? %>
      <style>.hide-on-mobile { display: none; }</style>
    <% end %>
HTML

say "Copy bridge controllers"
directory "#{__dir__}/app/javascript/controllers/bridge", "app/javascript/controllers/bridge"

say "Copy strada stylesheet"
copy_file "#{__dir__}/app/assets/stylesheets/strada.css", "app/assets/stylesheets/strada.css"

say "Add hide-on-mobile style in application layout"
insert_into_file APPLICATION_LAYOUT_PATH.to_s, "\n\n#{HIDE_ON_MOBILE_STYLE}", before: /\s*<\/head>/

say "Pin Strada"
say %(Appending: pin "@hotwired/strada", to: "strada.js", preload: true")
append_to_file "config/importmap.rb", %(pin "@hotwired/strada", to: "strada.js", preload: true\n)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
strada-rails-0.0.2 lib/install/strada_with_importmap.rb
strada-rails-0.0.1 lib/install/strada_with_importmap.rb