From bcc88cd7f4205b70e67a6f8787dc933a1b345276 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Thu, 9 Feb 2023 11:48:17 +0100 Subject: [PATCH] kind of works with importmaps --- app/assets/config/manifest.js | 5 ----- .../{application.js => application_legacy.js} | 0 app/views/layouts/_header.html.haml | 13 ++++++------- config/importmap.rb | 3 +-- config/initializers/assets.rb | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 app/assets/config/manifest.js rename app/assets/javascripts/{application.js => application_legacy.js} (100%) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js deleted file mode 100644 index 33237892..00000000 --- a/app/assets/config/manifest.js +++ /dev/null @@ -1,5 +0,0 @@ -//= link_tree ../images -//= link_directory ../stylesheets .css -//= link_tree ../../javascript .js -//= link_tree ../javascripts .js -//= link_tree ../../../vendor/javascript .js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application_legacy.js similarity index 100% rename from app/assets/javascripts/application.js rename to app/assets/javascripts/application_legacy.js diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index a842d713..66e14355 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -20,12 +20,11 @@ \================================================== / Placed at the end of the document so the pages load faster = javascript_importmap_tags + = javascript_include_tag "application_legacy" - -# = javascript_include_tag "application" - - -# :javascript - -# I18n.defaultLocale = "#{I18n.default_locale}"; - -# I18n.locale = "#{I18n.locale}"; - -# I18n.fallbacks = true; - -# = yield(:javascript) + :javascript + I18n.defaultLocale = "#{I18n.default_locale}"; + I18n.locale = "#{I18n.locale}"; + I18n.fallbacks = true; + = yield(:javascript) = raw FoodsoftConfig[:webstats_tracking_code] diff --git a/config/importmap.rb b/config/importmap.rb index 9d849852..050818ab 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,2 @@ # Pin npm packages by running ./bin/importmap - -pin "application", preload: true +pin "application", preload: true \ No newline at end of file diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 8082bb6f..e1c4d5fa 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,4 +9,4 @@ Rails.application.config.assets.version = '1.0' # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. -Rails.application.config.assets.precompile += %w( jquery.min.js ) +Rails.application.config.assets.precompile += %w( application_legacy.js jquery.min.js )