-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Take Sutil towards the Svelte experience #96
Comments
Well, it's
Using Sutil, the F# you write looks like this: let view() =
let model = Store.make 0
Html.div [
Ev.onUnmount (fun _ -> model.Dispose())
Bind.el (model, fun m -> text (sprintf "Counter = %d" m))
Html.button [
text "+"
Ev.onClick (fun _ -> model |> Store.modify (fun m -> m + 1))
]
] The proposition for using plugins is to get closer to the above without any of the boilerplate [<Sutil()>]
let view() =
let model = Store.make 0 // It's OK to be explicit about where our stores are defined
Html.div [
text (sprintf "Counter = %d" model)
Html.button [
text "+"
Ev.onClick (fun _ -> model <- model + 1 )
]
] Note:
|
exactly right as i understood you originally: the general f#-to-js workflow is: f# -> fable -> target language, which is javascript [JS] here. more specifically you're trying to replicate svelte, which essentially offers a minified version of FE-javascript that then compiles to JS that is more efficient than react (don't know appropriate terms for this type of workflow but it's not uncommon). my questions atm: @davedawkins can you recommend any cogent/useable fable plugin example? also does svelte rely on meta-compiler-plugins to transpile ? or does it use 3rd party utilities where there are comparable examples for f#? |
Opening an issue to discuss/document this idea further:
I personally am not familiar with fable (or really f# that much tbh).
I get what you're saying that if you could analyze the code being generated at the right stage (what stage?), you could automatically generate more code and reduce the burder on the user. Svelte is already a compiler and so it does this, to do the same you'd have to extend fable somehow to be able to generate more AST nodes for these things that eventually need to be bind.el-d?
Is it like this?
sutil -> fable -> html/ts
and if we do this
sutil -> [bind-identification-and-emitter] fable -> html/ts
then the sutil part becomes more like svelte (and also just simpler).
Can you expound on this further?
Recommended approach?
Best fable plugin documentation? (here is what i found, first seemed most applicable to this task)
The text was updated successfully, but these errors were encountered: