[openstreetmap/openstreetmap-website] Add Turbo to replace custom JS (PR #4562)
Gregory Igelmund
notifications at github.com
Wed Mar 20 19:43:53 UTC 2024
@grekko commented on this pull request.
> @@ -2,6 +2,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= javascript_include_tag "es6" unless browser.es6? %>
+ <%= javascript_include_tag "turbo", :type => "module" %>
This is the only way I was able to import Turbo (which comes bundled in ESM format in the `turbo-rails`-gem).
Trying to import it inside the `application.js` with Sprockets raises errors:
```diff
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index c71c0652d..25ca33d34 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -18,6 +18,7 @@
//= require qs/dist/qs
//= require bs-custom-file-input
//= require bs-custom-file-input-init
+//= require turbo
/*
* Called as the user scrolls/zooms around to manipulate hrefs of the
diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb
index 3c691612a..0ee5bf9c0 100644
--- a/app/views/layouts/_head.html.erb
+++ b/app/views/layouts/_head.html.erb
@@ -2,7 +2,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= javascript_include_tag "es6" unless browser.es6? %>
- <%= javascript_include_tag "turbo", :type => "module" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag "i18n/#{I18n.locale}" %>
<%= stylesheet_link_tag "screen-#{dir}", :media => "screen" %>
```

--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532751216
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4562/review/1949985251 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240320/0354163c/attachment.htm>
More information about the rails-dev
mailing list