I could not find a topic on this, so I'd like to get some sort of list. Especially focussed on developing for best performance.
To get us started, some tips I think are worth considering:
- Register JS in cache and only load it when needed as far as possible in your code
- Do not register functions in start, but in libraries and load those again only when needed, so not in start.php
- Check context where your plugin might be usefull (or not) and break the start routine if not.
- Same for plugins that require login or admin
- Use ElggBatch for possibly long running queries.
- Use ajax for on page toggles, form checks etc..
- Async load javacscript
Well that is my list which I violate myself sometimes :-( I really like more options and suggestions.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Gerard@gkanters
Gerard - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- put css in 'views/default/css/yourplugin/site.php'
- put js in 'views/default/js/yourplugin/site.php'
You must log in to post replies.I am unsure about the use of CDN's. It has benefits (offload and multiple connections from browser) and drawbacks (dependancy and sometimes decreases page load time)
Also unsure about extending views or replacing them.
I've got a good one
- just in time. Example, don't register a menu item (especialy in init) but register a hook for 'register' 'menu:something'. This way you don't do a lot of unnessesary stuff.
- also think about file structure in your plugin
why? This make it easier for theme developers to bundle all the css they need.