Skip to content

Commit

Permalink
refactor deps_routes(), set respective Genie compat
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Feb 26, 2024
1 parent 8565f22 commit fc7952d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Stipple = "4acbeb90-81a0-11ea-1966-bdaff8155998"

[compat]
DataFrames = "1"
Genie = "5"
Genie = "5.24.4"
PlotlyBase = "0.8.19"
Requires = "1"
Stipple = "0.27.30, 0.28"
Expand Down
67 changes: 18 additions & 49 deletions src/StipplePlotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module StipplePlotly
using Genie, Stipple, Stipple.Reexport, Stipple.ParsingTools
using Requires

import Genie: Assets.add_fileroute, Assets.asset_path

#===#

const assets_config = Genie.Assets.AssetsConfig(package = "StipplePlotly.jl")
Expand All @@ -15,61 +17,28 @@ _symbol_dict(d::AbstractDict) =

function deps_routes() :: Nothing
Genie.Assets.external_assets(Stipple.assets_config) && return nothing

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="plotly.min"), named = :get_plotlyjs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="plotly.min.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="ResizeSensor"), named = :get_resizesensorjs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="ResizeSensor.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="lodash.min"), named = :get_lodashjs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="lodash.min.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="vueresize.min"), named = :get_vueresizejs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="vueresize.min.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="vueplotly.min"), named = :get_vueplotlyjs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="vueplotly.min.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="sentinel.min"), named = :get_sentineljs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="sentinel.min.js")),
:javascript) |> Genie.Renderer.respond
end

Genie.Router.route(Genie.Assets.asset_route(assets_config, :js, file="syncplot"), named = :get_syncplotjs) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=normpath(joinpath(@__DIR__, "..")), file="syncplot.js")),
:javascript) |> Genie.Renderer.respond
end

basedir = dirname(@__DIR__)
add_fileroute(assets_config, "plotly.min.js"; basedir, named = :get_plotlyjs)
add_fileroute(assets_config, "ResizeSensor.js"; basedir, named = :get_resizesensorjs)
add_fileroute(assets_config, "lodash.min.js"; basedir, named = :get_lodashjs)
add_fileroute(assets_config, "vueresize.min.js"; basedir, named = :get_vueresizejs)
add_fileroute(assets_config, "vueplotly.min.js"; basedir, named = :get_vueplotlyjs)
add_fileroute(assets_config, "sentinel.min.js"; basedir, named = :get_sentineljs)
add_fileroute(assets_config, "syncplot.js"; basedir, named = :get_syncplotjs)

nothing
end

function deps() :: Vector{String}
[
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="plotly.min")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="ResizeSensor")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="lodash.min")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="vueresize.min")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="vueplotly.min")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="sentinel.min")),
Genie.Renderer.Html.script(src=Genie.Assets.asset_path(assets_config, :js, file="syncplot"))
script(src = asset_path(assets_config, :js, file="plotly.min")),
script(src = asset_path(assets_config, :js, file="ResizeSensor")),
script(src = asset_path(assets_config, :js, file="lodash.min")),
script(src = asset_path(assets_config, :js, file="vueresize.min")),
script(src = asset_path(assets_config, :js, file="vueplotly.min")),
script(src = asset_path(assets_config, :js, file="sentinel.min")),
script(src = asset_path(assets_config, :js, file="syncplot"))
]
end

Expand Down

0 comments on commit fc7952d

Please sign in to comment.