Skip to content

Commit bc1ab30

Browse files
committed
Fix import map handling.
1 parent 9a93149 commit bc1ab30

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

lib/utopia/project.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
require "utopia/localization"
1111

1212
require_relative "project/base"
13+
require_relative "project/import_map"
1314

1415
module Utopia
1516
module Project

lib/utopia/project/import_map.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require "utopia/import_map"
2+
3+
module Utopia
4+
module Project
5+
IMPORT_MAP = Utopia::ImportMap.build(base: "/_components/") do |map|
6+
map.import("mermaid", "./mermaid/mermaid.esm.min.mjs")
7+
end
8+
end
9+
end

pages/_page.xnode

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<link rel="icon" type="image/png" href="/_static/icon.png" />
1616
<link rel="stylesheet" href="/_static/site.css" type="text/css" media="screen" />
17-
18-
<script type="importmap" src="/_components/map.json"></script>
17+
18+
#{controller[:import_map].relative_to(request.path + "/").to_html}
1919

2020
<script src="/_components/jquery/jquery.min.js"></script>
2121
<script src="/_components/jquery-syntax/jquery.syntax.min.js"></script>

pages/controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
on "**" do
99
@base = Utopia::Project::Base.instance
10+
@import_map = Utopia::Project::IMPORT_MAP
1011
end
1112

1213
on "index" do

public/_components/map.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

utopia-project.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
3030
spec.add_dependency "markly", "~> 0.7"
3131
spec.add_dependency "rackula", "~> 1.3"
3232
spec.add_dependency "thread-local"
33-
spec.add_dependency "utopia", "~> 2.24"
33+
spec.add_dependency "utopia", "~> 2.31"
3434
end

0 commit comments

Comments
 (0)