-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Importing verbatim css from an external source into a LitConfig.styles element does not work:
let mycss' : {| ``default``: string |} = JsInterop.importAll "./public/some.css"
let mycss = mycss'.``default``
...
LitElement.init (fun cfg ->
cfg.useShadowDom <- true
cfg.styles <- [ css $"{mycss}" ]
)This compiles just fine, but crashes at runtime:
Error: LitElement.init must be called on top of the render function
LitElementUtil_failInit http://localhost:3000/build/client/fable_modules/Fable.Lit.1.4.1/LitElement.fs.js:24
Decorate http://localhost:3000/build/client/fable_modules/Fable.Lit.1.4.1/LitElement.fs.js:301
<anonymous> http://localhost:3000/build/client/OlMap.js?import&t=1653653843482:180
[client.ts:28:12](http://localhost:3000/src/client/client.ts)
As a workaround, this works:
[<Import("unsafeCSS", "lit")>]
let unsafeCSS str = jsNative
LitElement.init (fun cfg ->
cfg.useShadowDom <- true
cfg.styles <- [ unsafeCSS mycss ]
)Otherwise Fable.Lit is awesome!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels