Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Win Wang
    @wiwa
    Specifically, trying to use scalatags with http4s, not sure how to deal with CSS in this case :)
    Sakib Hadžiavdić
    @sake92
    what about scalacss maybe?
    Win Wang
    @wiwa
    i could use that but considering how scalatags supports css already, i feel sadness
    Li Haoyi
    @lihaoyi
    scalatags css is just one of many possible approaches, if it doesnt work for your use case don’t use it
    Kevin Meredith
    @kevinmeredith
    :question: Hi - could someone please point me to a basic example of using this library for building a simple <form> that submits application/x-www-form-urlencoded? Thanks!
    Li Haoyi
    @lihaoyi
    isn't the application-x-www-form-urlencoded thing handled by the browser? so it would just be a vanilla HTML <form>
    Kevin Meredith
    @kevinmeredith

    isn't the application-x-www-form-urlencoded thing handled by the browser?

    Yes, that's my understanding per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form.

    so it would just be a vanilla HTML <form>

    Could you please point me to such an example?

    Kevin Meredith
    @kevinmeredith
    Thank you, @lihaoyi , for your help and this library!
    ^^ Oh - I was asking about a simple <form> example in ScalaTags. After reviewing the well-written README, https://www.lihaoyi.com/scalatags/, I don't recall seeing a form example.
    Li Haoyi
    @lihaoyi
    oh it's just a mechanical translation between scalatags and HTML, so I didn't put one in
    in fact, it's so mechanical that often http://simerplaha.github.io/html-to-scalatags-converter/ is enough :P
    i use it quite often when copying HTML from documentation pages of libraries like bootstrap
    Li Haoyi
    @lihaoyi
    works like 97% of the time
    Kevin Meredith
    @kevinmeredith
    Thanks!
    Sakib Hadžiavdić
    @sake92
    Anyone knows how can I get this to work? https://scalafiddle.io/sf/f8vAr2s/1
    I'm just trying to abstract over AttrPairs in ScalaJS, but it seems impossible... :smile:
    tried to help it compile in lihaoyi/scalatags#205 but it doesnt work in runtime
    Sakib Hadžiavdić
    @sake92
    Li Haoyi
    @lihaoyi
    @sake92 I don't have any immediate ideas why that doesn't work, you might have to poke around JsDom.scala and see if you can figure out what it's doing wrong.
    Sakib Hadžiavdić
    @sake92
    @lihaoyi My bad.. :sweat_smile:
    I used Option[AttrPair]s and compiler got really mad at me..
    diverging implicit expansion for type Nothing => ba.sake.hepek.scalatags.Frag
    [error] starting with method bindNode in trait LowPriorityImplicits
    [error]       inputLabel.map(l => label(inputId.map(`for` := _.v)))
    Sakib Hadžiavdić
    @sake92
    if we could just get a new version carved out that would be great
    even better would be to get this fixed also.. :smile:
    lihaoyi/scalatags#200
    Sakib Hadžiavdić
    @sake92
    @lihaoyi could you please review this one? lihaoyi/scalatags#213
    And release a new version?
    Suvorovkot
    @Suvorovkot

    Hi!
    I am adding to dependencies "com.lihaoyi" %% "scalatags" % "0.8.6"
    Then it is added external libraries and IntelliJ idea marks import scalatags.Text.all._ as a correct import
    Though during sbt compile i've got this error not found: object scalatags

    Could anyone please tell me what may be the problem?

    Sakib Hadžiavdić
    @sake92
    did you reload sbt session after adding dependency?
    Suvorovkot
    @Suvorovkot
    Yep
    Suvorovkot
    @Suvorovkot
    It helped to import "com.lihaoyi" % "scalatags_2.12" % "0.9.2"
    nafg
    @nafg
    @Suvorovkot you should let %% add the _2.12 for you
    Sakib Hadžiavdić
    @sake92
    Hi guys! I made RxTags library for using Scalatags reactively. It focuses on simplicity above all. Feedback welcome! https://github.com/sake92/RxTags-Starter
    Matthias Toggweiler
    @m-a-t
    Hi, I am doing my first steps using scalatags. I would like translate my CSS to scala. How would you translate
    fusszeile:before {
        content: "Seite " counter(page) " von " counter(pages);
    }
    or
    @page {
        size: 210mm 297mm;
        margin: 20mm 30mm;
        @bottom-right {
            content: element(footer)
        }
    }
    Olivier Filangi
    @ofilangi

    Hello everyone, I 'll try (without success to inialized a a() tag with an onclick event)

     a(href:="#",
            onclick:= { (e: MouseEvent) => ... } ,
              raw("&laquo;"))

    this does not compile...I used this trick to have the waiting behaviours:

     a(id:="fa",
                href:="#",
                raw("&laquo;"))
     document.getElementById("fa").addEventListener( "click" ,
          (event:MouseEvent) => {
            println("Hello World !")
          })

    are they a solution more elegant to do that ?

    scalway
    @scalway
    @ofilangi Here it works: https://scalafiddle.io/sf/yiVHJDF/0. Not sure wjat was wrong in your case.
    Olivier Filangi
    @ofilangi
    @scalway thanks for your answer. This issue persist on my environnement....I copy your fiddle snippet to test and here the error message :
    No AttrValue defined for type org.scalajs.dom.MouseEvent => Unit; scalatags does not know how to use org.scalajs.dom.MouseEvent => Unit as an attribute [error] onclick:= { (e: MouseEvent) => println("test") } ,
    Olivier Filangi
    @ofilangi
    ok, error fixed, I was confusing scalatags.Text.all. and scalatags.JsDom.all.
    raboof
    @raboof:matrix.org
    [m]
    Just for fun, I made my mastodon profile image using scalatags to create the svg: https://merveilles.town/@raboof / https://git.sr.ht/~raboof/circle/tree/main/item/Main.scala
    (the circle thing)
    bwbecker
    @bwbecker

    I'm trying to write some common fragments to be rendered in both the DOM and Text. That is, something based on the Cross-backend Code at https://www.lihaoyi.com/scalatags/#Cross-backendCode.

    I'm having trouble integrating the fragment into other HTML. Using the example as a starting point, I'd like to do:

    ```
    p( TextTemplates.widget)

    p(TextTemplates.widget)

    But when I do that I get a compile error : found : oat.xplatform.views.SharedHtmlFragmentsJVM.bundle.all.Tag
    required: scalatags.text.Frag

    If I change the return type from Tag to Frag I get
    found : Frag (in scalatags.generic)
    required: Frag (in scalatags.text)

    If I write

    p(TextTemplates.widget.render)

    I get the literal html text of the widget in the paragraph.

    Suggestions?

    bwbecker
    @bwbecker
    PS: This is not my actual code, but it's pretty close.
    Sakib Hadžiavdić
    @sake92
    @bwbecker check out my code here: https://github.com/sake92/hepek/tree/master/hepek-components
    js vs jvm
    depending on what you compile, the import will be different
    in shared code..
    bwbecker
    @bwbecker
    I'll take a look. I understand that the import will be different.
    bwbecker
    @bwbecker
    @sake92 Thanks! Got it working. It took me a night's sleep to realize that this approach is quite different from what is documented in #Cross-backendCode. Once I crossed that bridge, it came together easily. This certainly seems simpler and easier.
    Sakib Hadžiavdić
    @sake92
    np, glad you got it working! :)
    bwbecker
    @bwbecker
    Can someone give me the quick overview of how to build scalatags and publish it locally? I need a version with pull request 214 applied. I looked at the Mill documentation but haven't been able to figure out how it works with cross-compiling. I need v0.9.3 for scalaJS 1.4.0 (and the JVM).
    Li Haoyi
    @lihaoyi
    @bwbecker ./mill __.publishLocal should work