https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • m

    mysterious-toddler-20573

    10/05/2020, 2:42 AM
    yeah, look at the package in /www/package.json
  • m

    mysterious-toddler-20573

    10/05/2020, 2:42 AM
    eleventy-plugin-sass
  • m

    mysterious-toddler-20573

    10/05/2020, 2:42 AM
    although it might rely on sass being installed :/
  • m

    mysterious-toddler-20573

    10/05/2020, 2:42 AM
    i really hate sass
  • m

    mysterious-toddler-20573

    10/05/2020, 2:42 AM
    less should have won
  • m

    mysterious-toddler-20573

    10/05/2020, 2:43 AM
    the event info would be a plugin, yes
  • g

    gorgeous-ghost-95789

    10/05/2020, 2:49 AM
    Ok. I’ll work it out from there.
  • g

    gorgeous-ghost-95789

    10/05/2020, 2:50 AM
    Is it wrong that I just prefer straight CSS? These tool chain guys really grind my gears 😉
  • m

    mysterious-toddler-20573

    10/05/2020, 1:03 PM
    i tried straight css for a while, but eventually gave up and went back to SCSS. Less should have won. I'm convinced that the bootstrap change to scss was due to personal lobbying rather than technical merit.
  • m

    mysterious-toddler-20573

    10/06/2020, 12:32 AM
    OK
  • m

    mysterious-toddler-20573

    10/06/2020, 12:32 AM
    so
  • m

    mysterious-toddler-20573

    10/06/2020, 12:32 AM
    @User and anyone else w/ an opinion
  • m

    mysterious-toddler-20573

    10/06/2020, 12:32 AM
    I have implemented general event filterins with the
    [arbitrary expression]
    thing
  • m

    mysterious-toddler-20573

    10/06/2020, 12:33 AM
    I'm not unhappy with it
  • m

    mysterious-toddler-20573

    10/06/2020, 12:33 AM
    but I wonder if it's a little too general
  • m

    mysterious-toddler-20573

    10/06/2020, 12:34 AM
    and we'd be better off with something more like the css attribute selectors: https://www.w3schools.com/css/css_attribute_selectors.asp
  • m

    mysterious-toddler-20573

    10/06/2020, 12:35 AM
    any thoughts on the current syntax?
  • b

    big-airline-13935

    10/06/2020, 8:58 AM
    @User Just coming back to htmx after some time away so trying to catch up on the developments. Is this the current syntax you have for event filtering?
    Copy code
    html
    <!-- Trigger a htmx request if the keydown event was caused by the `enter` key and the element's value is not blank -->
    <div hx-trigger="keydown[key=='enter' && elt.value!=='']" ...>...</div>
    Switching to CSS selectors would require writing a parser that can deal with all of the CSS attribute selectors (I assume), and keeping up to date with developments in CSS. So the simpler and more powerful approach would seem to be evaluating the JS expression as you are now, and since this is more of an advanced use-case, the lower level approach seems acceptable. https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
  • b

    big-airline-13935

    10/06/2020, 8:59 AM
    Perhaps @User, @User, @User have some opinions too?
  • m

    mysterious-toddler-20573

    10/06/2020, 1:10 PM
    @User yep, it's general javascript expression validation
  • m

    mysterious-toddler-20573

    10/06/2020, 1:12 PM
    you can even do stuff like this:
    Copy code
    html
    <div hx-trigger="keydown[['enter', 'escape'].indexOf(key) >= 0]" ...>...</div>
    <div hx-trigger="keydown[myValidationFunction(evt)]" ...>...</div>
  • m

    mysterious-toddler-20573

    10/06/2020, 1:12 PM
    I am getting more OK with it
  • m

    mysterious-toddler-20573

    10/06/2020, 1:13 PM
    The lexer isn't too complicated, and it is pretty damned general
  • m

    mysterious-toddler-20573

    10/06/2020, 1:37 PM
    https://twitter.com/htmx_org/status/1313466532005961728
  • l

    lively-beach-14291

    10/06/2020, 2:07 PM
    I think, as you get older, you've had to maintain several systems and come to appreciate how "clever is not helpful" unless it's very well explained and heavily tested.
  • b

    big-airline-13935

    10/06/2020, 2:11 PM
    @User I'd lean towards what you have now over using a CSS attribute selectors syntax, for which I can see feature request after feature request for adding more flexibility being submitted.
  • l

    lively-beach-14291

    10/06/2020, 2:14 PM
    There is an advantage of a limited DSL, that is, you know that the code won't be calling other functions or doing irregular things. That said, flexibility is nice.
  • b

    big-airline-13935

    10/06/2020, 2:18 PM
    In general I agree, however
    eval()
    is already being used in other parts of the code...
  • m

    mysterious-toddler-20573

    10/06/2020, 3:05 PM
    I'm pretty proud of the fact that we only call eval once per conditional expression 🦾
  • m

    most-jelly-15242

    10/07/2020, 11:05 PM
    And it's out https://getyoyo.dev/
1...535455...1146Latest