Code Monkey home page Code Monkey logo

Comments (11)

Dzoukr avatar Dzoukr commented on August 25, 2024 2

Sure. It is still very fresh, to-cleanup-and-refactor stuff, but I'll keep it here for tracking. Good point!

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Since now #2 is done, there are about one thousand lines of literals. I need to think how to extract them to proper [<Literal>] by script, or I would blow my head of doing it manually. 😄

from feliz.bulma.

Zaid-Ajaj avatar Zaid-Ajaj commented on August 25, 2024

Replace let by let [<Literal>] maybe?

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Uff, done. I had to write custom script, but it wasn't that hard.

from feliz.bulma.

Zaid-Ajaj avatar Zaid-Ajaj commented on August 25, 2024

The generated classes are made literal but the consuming helpers are not. i.e.

module helpers =
    let isClearfix = PropertyBuilders.mkClass "is-clearfix"
    let isPulledLeft = PropertyBuilders.mkClass "is-pulled-left"
    let isPulledRight = PropertyBuilders.mkClass "is-pulled-right"

should be

module helpers =
    let [<Literal>] isClearfix = PropertyBuilders.mkClass "is-clearfix"
    let [<Literal>] isPulledLeft = PropertyBuilders.mkClass "is-pulled-left"
    let [<Literal>] isPulledRight = PropertyBuilders.mkClass "is-pulled-right"

Otherwise Fable will generate unnecessary module exports. This way, they all still compile down to just strings

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Oh... This one... 🤦‍♂ I'll fix it, thanks!

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Oh, wait a moment. But they are IReactProperty, not string type.

from feliz.bulma.

Zaid-Ajaj avatar Zaid-Ajaj commented on August 25, 2024

Ohh my bad. Then they should be a static class that has inline static members such that Fable ignores them altogether when compiled unless they are actually used 😀

Before

[<RequireQualifiedAccess>]        
module tag = 
    let isNormal = PropertyBuilders.mkClass ClassLiterals.``is-normal``
    let isMedium = PropertyBuilders.mkClass ClassLiterals.``is-medium`` 

After

[<Fable.Core.Erase>]        
type tag = 
    static member inline isNormal = PropertyBuilders.mkClass ClassLiterals.``is-normal``
    static member inline isMedium = PropertyBuilders.mkClass ClassLiterals.``is-medium`` 

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Please can you review now (and close if ok for Fable) 🙏

from feliz.bulma.

Zaid-Ajaj avatar Zaid-Ajaj commented on August 25, 2024

Nested static classes not supported

They are not supported, but you still could...

[<RequireQualifiedAccess>]
module icon = 
  [<Fable.Core.Erase>]
  type fa = 
    static member inline solid n = PropertyBuilders.mkClass (sprintf "fas fa-%s" n)
    static member inline regular n = PropertyBuilders.mkClass (sprintf "far fa-%s" n)
    static member inline light n = PropertyBuilders.mkClass (sprintf "fal fa-%s" n)
    static member inline duotone n = PropertyBuilders.mkClass (sprintf "fad fa-%s" n)
    static member inline brands n = PropertyBuilders.mkClass (sprintf "fab fa-%s" n)

Though for font awesome I would recommend using the zanaptak/TypedCssClasses typed provider to pull the icon names in design-time (or use the the type provider in your build script using this to generate static font awesome icons)

The rest look good to me 👍

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Yeah... you are right. I can create helper for font awesome on project level and keep this one clean.

from feliz.bulma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.