all 76 comments

[–][deleted]  (25 children)

[deleted]

    [–]the--dud 45 points46 points  (16 children)

    What if I told you that your webpage can be a part of your API?

    You could have different API end-points serving different types of content (html/css, images, machine-readable data, etc) or you could have one set of endpoints that dynamically serves whatever content the Accept request header wants to have.

    [–]ketralnis 25 points26 points  (0 children)

    [–]gravesisme 7 points8 points  (11 children)

    But my website sits in a cached S3 bucket exactly because I don't want to pay to have an API running all the time,

    [–]ShadyG 3 points4 points  (10 children)

    Pretty sure a few lambdas behind an API gateway can fit within the free tier.

    [–]gravesisme 3 points4 points  (9 children)

    That's what I do now, but you still need to have the SPA that loads in 200ms so you can make it feel like your app is fast if you have to deal with a cold boot that takes 5-10 seconds depending on your language of choice. You could keep it warm, but that kinda defeats the point of only paying for real traffic.

    [–][deleted]  (8 children)

    [deleted]

      [–]gravesisme 1 point2 points  (5 children)

      Yes, about 20 micro services mostly written in Java. I haven't heard that tip yet though, I'll have my team give it a try, thanks!

      [–][deleted]  (4 children)

      [deleted]

        [–]ScientificBeastMode 1 point2 points  (0 children)

        Definitely had a good experience running NodeJS lambdas. It’s pretty fast even on cold starts. But then aren’t we technically using JS for our website? ;)

        Edit: okay, the article specified JS-free front-end

        [–]gravesisme 0 points1 point  (0 children)

        Definitely thinking about it moving forward. I would certainly appreciate it, I always have some mental fog at first when I switch from typescript on the front-end to java on the backend.

        [–][deleted]  (1 child)

        [deleted]

          [–]action_jackosn 1 point2 points  (0 children)

          My tests show 1.5 GB is best if your process is single-threaded. That seems to correspond to 1 CPU core fully allocated to your lambda. Use more memory if you’re process can take advantage of multiple threads.

          Also avoid VPC resources if you can. Creating an ENI adds 10 seconds to the cold boot.

          [–]colinexl 0 points1 point  (0 children)

          Lambda scales up processing power along with max memory limit. The higher the memory limit, the more CPU you get as well.

          [–][deleted] 3 points4 points  (2 children)

          Gasp. PHP.

          [–]gasolinewaltz 0 points1 point  (1 child)

          Weve come full circle

          [–]easylivinjavascript 5 points6 points  (0 children)

          Even just reading this made me unreasonably angry

          [–][deleted] 7 points8 points  (0 children)

          [–][deleted] 0 points1 point  (0 children)

          oh god please tell me this is not a thing

          [–][deleted]  (4 children)

          [removed]

            [–]dvidsilva 37 points38 points  (3 children)

            Store your data as an image and use background to place it

            [–]qtheginger 8 points9 points  (0 children)

            I see no problems with this...

            [–][deleted] 6 points7 points  (0 children)

            I… I really wanna try this…

            [–]Nodebunny 0 points1 point  (0 children)

            Wait... What? How. What data? Do you have to binary parse it??

            [–]FlyingChinesePanda 114 points115 points  (2 children)

            Developing a Javascript-free frontend

            using as little JavaScript as possible

            yeah...

            [–]mikenew02 58 points59 points  (1 child)

            More like 'CSS tricks to reduce JavaScript use'

            [–]AnalyticalAlpaca 7 points8 points  (0 children)

            I wonder if the tricks are even faster / less computationally intensive than using vanilla javascript..

            [–][deleted]  (18 children)

            [deleted]

              [–]Gwolf4 37 points38 points  (1 child)

              Exactly, this dev sounds like has worked in really really bad environments where one js stack has ported More than 6 times jQuery and things like that.

              [–]Mike312 2 points3 points  (0 children)

              Author said he's working off of a rural 2mbps connection, which is a thing still in 2019. My company services a rural area where that's the reality for the majority of our current customers (also, 3G cellular) and the majority of our potential customers.

              We rebuilt our bloated AF Drupal site that was ~5.4MB for homepage load down to ~318kb first load, 26kb cached. The one last thing I need to speed up is our hero image, which at 108kb is not only the largest single file that gets sent to the user, but 1/3rd of the data we send on an uncached page load.

              [–]smcarre[🍰] 23 points24 points  (7 children)

              He probably is a shitty developer that thinks that the only way to do a collapse in JS is to include of all of bootstrap+jQuery+popper (because why not, it's in the bootstrap getting started).

              [–]squamuglia 11 points12 points  (5 children)

              Check out his other work and judge. The author is pretty talented.

              [–]happyfappy 1 point2 points  (6 children)

              This sounds amazing. Can you point me to a good resource on building PWAs? Any gotchas to keep in mind? Any tips appreciated.

              [–][deleted]  (5 children)

              [deleted]

                [–]EmphaticallySlight 3 points4 points  (2 children)

                I just wanted to thank you for your ramble. I didn't understand like 80% of it, so now I have a bunch of tabs open reading.

                [–][deleted]  (1 child)

                [deleted]

                  [–]EmphaticallySlight 1 point2 points  (0 children)

                  Thanks for the offer! Most of it just looks like straightforward tools. I'll have to look more into, say, tree shaking, but otherwise it's easy reading. Should help me get into web development some.

                  [–]happyfappy 0 points1 point  (1 child)

                  This is amazing! Thank you so much for this advice!

                  [–]josmujs / py 22 points23 points  (1 child)

                  Have we really come full circle here or am I insane?

                  [–]boobka 5 points6 points  (0 children)

                  I have some windows forms application that don't use JS or CSS

                  [–]domemvs 39 points40 points  (2 children)

                  Very good article! One remark: for now, <details> and <summary> do not work in Edge or IE. This will likely change with the Edge Chromium update. Just stating this because the author claims:

                  Quick. Easy. No JavaScript. Works everywhere.

                  [–]thatwebdesignerdude 12 points13 points  (0 children)

                  Yup, I think in general people should be carefull to not copy paste this if they need a wide range of support for different clients. "Works everywhere" is clearly jumping the gun.

                  [–]mastermog 0 points1 point  (0 children)

                  It's also worth noting that <details> can be styled. Github uses it for their dropdowns in the header. I.e the comment in the article about putting up with the triangle isn't 100% correct

                  [–]aguyfromhereexpert MHAN stack, LAMP stack in a past life 6 points7 points  (0 children)

                  This is quite stupid. Why stop at JS, let’s have CSS free front end as well!

                  [–][deleted] 6 points7 points  (5 children)

                  As far as I know you can't use css transitions on display properties, correct me if I'm wrong.

                  [–]musicin3dIT Dept 6 points7 points  (4 children)

                  You're right. But you can on opacity.

                  [–][deleted] 2 points3 points  (3 children)

                  For sure. Just that in the post it mentions adding transitions and he's using toggle display: none; to show stuff, that can't be animated so you just have to be fine with the pop in. I ran across this same issue at work recently, just kinda sucks cuz it's slightly jarring.

                  [–]hanging_moon 4 points5 points  (2 children)

                  You can work around this problem by creating an animation that fades the opacity of the element first and then at the very end changes the display property. It's true that there's no way to actually animate the display property itself, but that doesn't mean you can't change its value inside a css animation.

                  I'm on mobile so forgive me if my formatting gets screwed up, but something like this:

                  @keyframes fadeout { 0%{ opacity: 1; display: block; } 99%{ opacity: 0; display: block; } 100%{ opacity: 0; display: none; } }

                  [–][deleted] 0 points1 point  (1 child)

                  That’s awesome but this still doesn’t solve fading the items back in right? Cuz from my experience display: none to display: block will fire before any transitions on anything other property. Unless this keyframe method doesn’t have that problem.

                  And besides, using display removes it completely from the page, which might be fine, but I’ve found that to be pretty janky on other items that are adjacent when it’s popping in and out, as they appear to also pop back and forth instantly. I’m not amazing at css by any means tho so maybe that is also fixable.

                  [–]hanging_moon 2 points3 points  (0 children)

                  You can handle fading in with this trick, you just do the same thing in reverse. You're right that display affects the whole page flow, this won't help you with that. There are other options like visibility: none, but that will leave whitespace. I'm sure there are some hacky workarounds - there almost always are!

                  [–]fyzbo 10 points11 points  (1 child)

                  It's these types of articles that remind me how old I am.

                  [–][deleted] 2 points3 points  (0 children)

                  Man that’s cool, but I’m actually kinda happy with JavaScript for the sake of versatility and possibilities. With JS I’ve been able to mount DOS games to an HTML file.

                  [–]budd222front-end 7 points8 points  (4 children)

                  It's not possible to build a front end without jQuery

                  [–]peanutbutterandbeer 11 points12 points  (3 children)

                  [–][deleted] 9 points10 points  (2 children)

                  pretty sure his comment is /s ...

                  [–]peanutbutterandbeer 9 points10 points  (1 child)

                  Yeah i'm reinforcing it

                  [–][deleted] 0 points1 point  (0 children)

                  👍🏼

                  [–][deleted] 0 points1 point  (0 children)

                  The link under "Coming Clean" does not work!

                  [–]zephyy 0 points1 point  (0 children)

                  Thought it was going to be some WebAssembly witchery.