Organizing jQuery snippets through js frameworks

I have an application for the zend framework with several scripts and distributed jquery code that looks awful and difficult to maintain (no structure, fragments, etc.).

Now I want to do a cleanup by centralizing all the javascript related to the application.

Is there a js framework that helps me streamline jquery material to a central and structured JavaScript level? Maybe something like angular.js, backbone.js is related? I do not know if this framework is suitable for my problem or just the extra overhead.

+4
source share
2 answers

I would recommend backbone.js to you, because it does not have a built-in data binding, so it does not have special html code requirements. I can highly recommend the peepcode tutorial , you will get a great bonus in your learning curve. With the spine You will have great power in unleashing the client-side layer in the model and presenting jquery spagetti in place of the classic events, and you will continue to use jquery where you want to keep it. I'm sure you can get this with other client MVCs too, but think about โ€œtwo-way bindingsโ€ frameworks (Angular, knockout, ...), which require html inline binding attributes to indicate user interface behavior.

0
source

I recommend using requirejs to control js on your site. It was designed to ensure the strict structure of your js. http://www.requirejs.org/

One of the main reasons for using require.js is that it adds an object oriented programming style for javascript.

0
source

Source: https://habr.com/ru/post/1436301/


All Articles