Lazily load any content on your Neos site
This package allows you to mark any part of page for asynchronous loading via AJAX with just one line of Fusion code. Why? It helps you to speed up initial page load by delaying the load of some less relevant parts of the page, e.g. comments.
- Install the package
composer require psmb/ajaxify
@process.myUniqueKey = Psmb.Ajaxify:Ajaxifyon any Fusion path. The
myUniqueKeykey of the processor MUST be globally unique.
Add this anywhere in your Fusion code to include the sample AJAX loading script:
Or include these assets via your build tool. Or just write your own loader.
- Done. Now part of your pages will be lazily loaded via an AJAX request.
Note: the Fusion component should not depend on any context variables, other than the standard ones.
If you want to reuse some EEL expression in your code base, don't put it into context, rather wrap it into
Neos.Fusion:Value object and use it everywhere you like.
- You may override the
Psmb.Ajaxify:Loaderobject in order to customize the loader.
- If you use it, submit yours via a PR!