[openstreetmap/openstreetmap-website] Load js controller modules only when needed (PR #7147)

Marwin Hochfelsner notifications at github.com
Sun Jun 21 19:05:06 UTC 2026


@hlfan commented on this pull request.



> @@ -33,9 +33,15 @@ OSM = {
 
   LAYER_DEFINITIONS: <%= MapLayers::full_definitions("config/layers.yml", :legends => "config/legend.yml").to_json %>,
 
-  RTL_TEXT_PLUGIN: <%= javascript_path("@mapbox/mapbox-gl-rtl-text/dist/mapbox-gl-rtl-text.js").to_json %>,
-
-  MAKE_PLURAL_CARDINALS: <%= javascript_path("make-plural/cardinals.js").to_json %>,
+  MODULE_PATHS: <%=
+    %i[changeset directions element export history home index new_note note query search]
+      .each_with_object({}) { |module_name, hash| hash[:"index_#{module_name}"] = "index_modules/#{module_name}" }
+      .merge(
+        :mapbox_rtl_text => "@mapbox/mapbox-gl-rtl-text/dist/mapbox-gl-rtl-text.js",
+        :make_plural_cardinals => "make-plural/cardinals.js"
+      )
+      .transform_values { |path| javascript_path(path).sub('javascripts/', 'assets/') }

Then something wasn't quite right during prototyping; it works now without the `sub` for me, too.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7147#discussion_r3448915788
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7147/review/4540144691 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260621/e1a9ef0a/attachment.htm>


More information about the rails-dev mailing list