El miércoles, 21 de octubre de 2015, 3:39:34 (UTC+2), Rod Watkins escribió: > > So let me ask, was the conversion to a client side SPA worth it? Also, can > I use just ractive and let web2py do the routing and some of the templating > (I guess that sort of how Massimo did it in the estore project)? >
The conversion is still WIP, so I can't really tell. But my feelings are: - It feels faster and more professional as a user. Then menus and footer are not reloaded, but above all, each ilbrary is run only once. Change page in a multi page app, and you sure get the js libraries from the cache, but they need to be run again. Do it in a SPA, and you run only the bare minimum javascript code. - In the mid term, you will tend to write lighter ajax json calls. That's more efficient for small requests, and from the client side it looks more modern. - In the long term, you will see other chances for improving efficiency with many nice frontend tools like webpack and gulp, like for example translating the strings and preparing a bundle with all your minified javascript, and your translations, in one file that you can gzip. On the downside, my app has several complex views that use heavy js libraries: ckeditor, handsontable, jqplot, corefive filemanager and others that most users don't need all the time. So I decided not to bundle everything into a big webpack bundle. webpack apparently allows to break your code into several bundles, but AFAIK if you load a web2py component, your code is not run inside webpack, and you can't "require" libraries using the normal mechanism. Furthermore, some libraries like CKEDITOR do not work with webpack (neither require.js nor browserify), so I'm not using ewbpack for everything. Instead, I load non-essential libraries with jQuery.getScript, till the day comes when I have moved all views from web2py into ractive views, and I can use webpack's "code splits". It has taken a lot of research to find and choose the libraries I like. As Niphlod says, you either use a monster framework, or cherry pick one library for each task. If you decide to go this way, I really like jquery (it really pays to read the docs, it's even more useful that it first seems), bootstrap (a time saver if you're not into UX and design), ractive (using components) and jquery.form (you need it to send files through ajax). I'm not so happy with CKEDITOR or page.js. webpack is super-pro, but it may or may not be the best fit for your goal. See, I can't really compare the benefits of this approach versus Massimo's store. I had one idea when I started and changed my mind since I started. Look, I'm not a pro and I'm a first timer with front end frameworks (or not frameworks), so if you can get an opinion from Massimo or Niphlod, you should give that more weigth. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.