• Blackmist@feddit.uk
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    1
    ·
    6 hours ago

    Which CSS framework is it that puts this shit everywhere?

    That one can die in a fire.

    • ThunderComplex@lemmy.today
      link
      fedilink
      arrow-up
      15
      ·
      5 hours ago

      fun fact: This isn’t any one specific CSS framework’s doing but rather part of how JS UI libraries handle scoped CSS. When you have for example two components that have similar CSS, like one component sets button to color green, another component sets button to blue, then the compiler does this kinda thing because “real” CSS doesn’t support scoping.

      So in the above example you’d get button class abcd and button class bcde.

    • expr@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      5 hours ago

      I’m honestly not sure, but I’m fairly certain it’s intentional obfuscation done for the production build. Why they think it’s so important to hide class names, I’ll never know.

      • yumyampie@lemmynsfw.com
        link
        fedilink
        arrow-up
        2
        ·
        52 minutes ago

        It is not intentional. The tooling needs to generate a short unique id to prevent css name clashing.

        During development 2 developers can write the same css class name in two seperate places:

        • developer A: .container { padding: 8px } at dashboard
        • developer B: .container { padding: 32px } at sidebar

        Without this tooling developer need to find ways to prevent name clashing:

        • .dashboard__container
        • .sidebar__container

        and they need to do this for every class name.

        with this tool, developer don’t have to worry about this ever, continue using .container and it get generated into:

        • .aP2be7
        • .7aFrJp