4 ms·
Just curious, how do you handle the vanilla-JS stuff? 1) inline with your view files 2) write them in separate js files and include them depending on the page
by amnah 9y ago
Just curious, how do you handle the vanilla-JS stuff?
1) inline with your view files
2) write them in separate js files and include them depending on the page
3) concat them into one big js file which gets included on every page
4) something else?
- olavgg 9y agoYes, we do a lot of inlining at the end of a view. In every case when the javascript is only usable for that view we find this very clean, every developer can immediately see what javascript is running on that particular view. We have our own small library for the more common operations, for small things like more effecient navigating of the DOM three or more complex "components" that for example convert a select element to a nicer selectbox with built in full text search. That library is included for every view. This library weight around 50kb gzipped.
- noway421 9y agoSome companies go for that 'disciplined javascript' style. It's a nice paradigm to follow, but every time you'd want to make it slightly more advanced (as the app grows) you'd have to implement tooling on your own.