9

I started a new project and only use PHP, HTML, CSS and vanilla JS. No Frameworks. No React. No Vue.

The browser loads the page instantly, there is virtually no loading time and it just works.

Comments
  • 4
    Yeah but does it support IE11 and has a feature or two?
  • 8
    Now put down authentication, geolocation stuff, actual state management and see your code expand exponentially.

    Frameworks exist for preserving devs' sanity as well ya know ;)
  • 3
    That's because it's fit for website with few interactivity features. You know what's even faster? Loading speed after removing PHP middleware. Bring JAMstack solution and generate plain HTML at deploy time, DRY. Extending? Svelte it.
  • 3
    @3rdWorldPoison eh, I wrote plain XHR js authentication, using jwt tokens and with refresh token support. It's like 300 lines of code which is nothing really. (Person project, security was of little concerned at this stage)

    @turbopixel
    Where Id put the real advantage of frameworks is that they do it and patch it "securely". Otherwise we would all have to constantly react to all sorta of vulnerabilities ourselves.

    That being said, It's good practice to know how to do it and It's also true that frameworks do add bloat too so in the end it depends on what your priorities are for a particular project
  • 1
    Challenge: drop the CSS and PHP. Go Node for the server.
  • 1
    Wait till you need to interact with the DOM, states and other interactions where you'll end up having code less maintainable and one that isn't performant, that's where some libraries and frameworks shine.
    It's nice to do everything yourself and not depend on library, but that comes at a cost.
  • 1
    i approve, but i would still want something jQuery-like, just to have the DOM selection and manipulation have sensibly short and straightworward code as opposed to the ridiculous default JS stuff.

    getElementById().childNodes.getElementsByTagName().setAttribute(), anyone? XD

    oh, hey, querySelector exists now! cool! still too long, would need wrapping into $(), plus some better way for attribute setting/getting.

    that (and the fact that i'm too lazy to implement a mini lib that would do the above) is literally the only reason i (still) use jQuery.
  • 1
    @Midnight-shcode Want my querySelector wraper? I can make a gist tomorrow.
    It detects if your selector is simple, in which case it uses the specific method (getElementById, getElementsByClassnames, getElementsByName, etc.) and let's you choose to select the first match, all matches, or n matches with an optional 2nd argument. It even let's you choose the root (root.querySelector...) with the third.
    Best of all, it's faster than querySelectorAll (Tested. I can't understand how if it's a freaking wrapper.).
    I called it SqS (standing for Super querySelector).
  • 1
    @c3r38r170 sure, sounds nice :)
  • 0
    @Midnight-shcode Shipping in ≈5 hours.
  • 0
    umbrella.js is a very good jquery alternative. And bulma as css Framework is fine.
  • 1
    @Midnight-shcode

    Late but here it is. It took me a bit but as it's one of the first pieces of code I ever wrote and I haven't touched it in some time, I wanted to give it a revision.

    https://gist.github.com/c3r38r170/...

    WTFPL

    Any criticism is accepted as well.
Add Comment