Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add @stipple_precompile for easier precompilation of user apps #293

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

hhaensel
Copy link
Member

@hhaensel hhaensel commented Oct 12, 2024

This PR strongly simplifies the writing of a precompile section for Stipple apps.

Stipple.jl itself now uses the new macro @stipple_precompile to precompile functions for typical usage. The previous defintion has come down to.

@stipple_precompile begin
    ui() = [cell("hello"), row("world"), htmldiv("Hello World")]

    @app PrecompileApp begin
        @in demo_i = 1
        @out demo_s = "Hi"

        @onchange demo_i begin
        println(demo_i)
        end
    end

    route("/") do 
        model = Stipple.ReactiveTools.@init PrecompileApp
        page(model, ui) |> html
    end

    precompile_get("/")
    deps_routes(core_theme = true)
    precompile_get(Genie.Assets.asset_path(assets_config, :js, file = "stipplecore"))
end

and all previous of spinning up a server which doesn't spill the precompilation output and checking whether server requests should be carried out during precompilation are now handled by the macro.
HTTP.get simply needs to be replaced by precompile_get()
The previous setting ENV["STIPPLE_PRECOMPILE_GET"] has been replaced by ENV["STIPPLE_PRECOMPILE_REQUESTS"] but is currently kept for backward compatibility.

@hhaensel hhaensel merged commit 83a1125 into master Oct 12, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant