Skip to content

Commit

Permalink
fix export for AssetFolder (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Jan 8, 2024
1 parent 73ee00c commit 89a3745
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/js_source.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ function Base.show(io::IO, jsc::JSCode)
print_js_code(io, jsc, JSSourceContext())
end



function print_js_code(io::IO, @nospecialize(object), context::JSSourceContext)
id = get!(() -> string(hash(object)), context.objects, object)
print(io, "__lookup_interpolated('$(id)')")
Expand Down Expand Up @@ -107,6 +105,14 @@ end
function import_in_js(io::IO, session::Session, asset_server, asset::Asset)
ref = url(session, asset)
if asset.es6module
# Use absolute paths for es6modules, since they're not relative
# To the HTML file they're used in, but instead to the Bonito.js file
# TODO, teach Bonito about where the JS files are located,
# to make them relativ
# Should only be relevant for AssetFolder
if startswith(ref, ".")
ref = ref[2:end]
end
print(io, "import('$(ref)')")
else
print(io, "Bonito.fetch_binary($(ref))")
Expand Down Expand Up @@ -151,7 +157,6 @@ function inline_code(session::Session, asset_server, js::JSCode)
src = code
else
# reverse lookup and serialize elements

interpolated_objects = Dict(v => k for (k, v) in context.objects)
binary = BinaryAsset(session, interpolated_objects)
src = """
Expand Down

0 comments on commit 89a3745

Please sign in to comment.