chanan/BlazorStyled

Look into ways to pre-render styles in SSB

開放

#3 建立於 2019年7月2日

 (14 則留言) (1 個反應) (0 位負責人)C# (19 個分叉)github user discovery
enhancementhelp wanted

倉庫指標

星標
 (193 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Right now, SSB works like this:

<p class="@div">If everything is working right, the background of this paragraph tag should be pink.</p>

@code {
    private string div;

    protected override async Task OnAfterRenderAsync()
    {
       div = await Styled.Css("background-color: pink;");
       StateHasChanged();
    }
}

While this works, it will cause a small flicker on the browser side because the plain html will be rendered first then "enhanced" with the css.

Is there a way the all the styles can be "pre-rendered" and set down with the html?

貢獻者指南