Dev Discussion About a Native JS Loader
Following up on his EECI EU talk on finding new ways to publish, Christopher Imrie started a thread in the EE forums to discuss standardizing on a JavaScript loader in EE.
Due to the increase in number of JavaScript rich fieldtypes and addons that are being made available for EE, I believe EllisLab needs to begin to address the need for a standard JavaScript loader to operate site wide in the CP.
At the moment, most addons work by directly adding script elements to the CP head, which leads to slow loading times, particularly on highly customisable pages such as the Publish Page. We are also seeing that many addons are still of the “single javascript file” mindset, and depend heavily on PHP to directly manipulate the JavaScript output. The single javascript file mindset leads to large monolithic JavaScript files which are difficult to debug and the high PHP environment dependency makes portability of the module very difficult (eg: making a fieldtype with a JavaScript powered UI work with SafeCracker).
A standard JavaScript loader, according to Christopher, could “promote the future growth of ‘Rich’ UI add ons.” He mentions RequireJS as a possibility.
Do you have an opinion on this and want to chime in? The thread is open and waiting for your feedback.
Christopher Imrie — 09:32 on 06.08.2012
Thanks for bringing attention to the post Ryan!
This is an issue that I believe needs to be looked at, discussed and planned. It is not something that can be remedied and implemented over night, so the earlier it is brought to everyones attention the better.
telilomzrhy — 09:14 on 06.09.2012
can I at any occasion cleaning Side of <a >shanghai escorts</a> the suction hood moral cleaning the lubricator
Christopher Imrie — 10:36 on 08.13.2012
Hey Ryan,
Just wanted to make you aware that as a result of that article, I’ve gone ahead and created a RequireJS extension for EE that allows you to load JS assets asynchronously anywhere in the control panel.
In addition to RequireJS’ own API, the extension creates a PHP API that allows you to specify JS assets to be loaded in parallel on page load, along with a callback to be fired when complete.
Its on Github:
https://github.com/ckimrie/RequireJS-for-EE