Sha256: dfd96066ea3d1a1c95981d48a0dd6b160929aac55834e32c030ad2d6265cf634

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

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

destination = Pathname(destination_root)

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

say "Update stimulus manifest"
rails_command "stimulus:manifest:update"

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

unless destination.join("app/assets/application.css").exist?
  if (stylesheets = Dir.glob "#{destination_root}/app/assets/stylesheets/application.*.{scss,css}").length > 0
    insert_into_file stylesheets.first.to_s, %(@import 'strada.css';)
  end
end

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 "Install Strada"
run "yarn add @hotwired/strada"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strada-rails-0.0.3 lib/install/strada_with_node.rb