0

Let me be straight: knockout.js is a pain in my sitting device. It creates yet another layer of abstraction, is hard to debug, creates enormous overhead (more files, more code, more possibilities for errors) slows down the frontend and worst of all it makes the frontend feel jerky. After HTML is done loading knockout starts it's magic and modifies the DOM. Some HTML elements are not functional from the start or show up after a delay (how can this be desirable???).

I have read a lot about knockout and all the praises but not a single argument was really convincing. The gains always come at a great cost. Everything knockout does can be achieved with pure HTML and well crafted custom javascript. I have been building stores this way for years and they are lean and quick.

So here is my question: given a particular part of the store using knockout.js (e.g. the layered navigation filters) how could that functionality be reversed the old school way of building HTML and Javascript using XML layouts and phtml files? It all seems to be so deeply entangled into the core.

1

Every front-end developer feels your pain deeply, it is not as much the fault of knockout.js but the overly complex integration magento chose where the whole thing should be as configurable as possible.

First an advice: Wait to see what Magento is doing with their PWA studio, at the moment i'm posting this answer it seems like we are getting a complete new store front built up from scratch with React and Redux and I have good hopes they might get it right this time.

Now that I got that out of the way: The easiest way to port out knockout.js as I see it is get rid of entire modules and build them from scratch yourself, like you said everything is deeply entwined in Magento's core. It isn't as simple as "delete this line" and replace it with this. The entire checkout is built up with knockout and Payment Service Providers are building their extension based on knockout, so you'll be responsible for new integration with those aswell.

If you truly want to start this brave and bold venture you have a lot of work ahead of you. And you might want to look at other e-commerce platforms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.