Jazzcat is a Mobify Cloud feature. You must be a Mobify Cloud user to use it with Mobify.js.
Jazzcat improves script loading performance by enabling single request loading of multiple JavaScript files.
Imagine a page loads three JavaScript files, a.js, b.js and c.js:
<script src="a.js"></script>
<script src="b.js"></script>
<script src="c.js"></script>
Jazzcat improves performance by loading all three files together in a single request:
<script src="//jazzcat.mobify.com/a.js,b.js,c.js"></script>
<script>Mobify.jazzcat.load("a.js");</script>
<script>Mobify.jazzcat.load("b.js");</script>
<script>Mobify.jazzcat.load("c.js");</script>
Mobify.js provides an API to format scripts for use with Jazzcat.
Inside your konf, use $ to select the scripts that you would like to
use with Jazzcat and then format them using combineScripts:
'scripts': function() {
$scripts = $('script').combineScripts();
return $scripts;
}
Next write out the formatted scripts in a template. A good place is in
your base.tmpl just before the </body>:
<html>
<head>...</head>
<body>
...
{scripts}
</body>
</html>
$.fn.combineScripts()Searches the collection for script elements and and modifies the external scripts to use the Jazzcat service. Returns all found scripts in DOM order.
{foo} - Variables: Select & Render A Single Variable{foo|bar} - Variable Filters: Pass The Value foo Through Filter bar{#foo} ... {/foo} - Accessing Attributes Of, Or Descending Into The Variable foo{#foo} ... {.} ... {/foo} - Iterate Over The Variable foo{>foo/} - Include The Partial foo Inside The Current Template{+bar} ... {/bar} - Block Placeholders{<bar} ... {/bar} - Block Overrides{?foo} ... {/foo} - Conditional, Check For The Existence Of Variable foo{^foo} ... {/foo} - Conditional, Check For The Non-existence Of Variable foo{%script} ... {/script} - Inline Script Pragma{! Comment !} - Template Comments