Skip to content

Instantly share code, notes, and snippets.

@anfibiacreativa
Created March 29, 2020 18:40
Show Gist options
  • Save anfibiacreativa/8d99e53cb1c27c94a70e80309140878e to your computer and use it in GitHub Desktop.
Save anfibiacreativa/8d99e53cb1c27c94a70e80309140878e to your computer and use it in GitHub Desktop.
<!--/* Firsy of all, you need to import the clientlibs template */-->
<sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html">
<!--/* You can then use the call API, to call the right clientlib category, for the right use case. In the example below
you're calling the js files only, for the 'my.category' category */-->
<sly data-sly-call="${clientLib.js @ categories='my.category'}" />
<!--/* Supposing you have special style rules for your authoring mode, you can test for wcmmode and include the right styles too
while avoid requesting them in publish, for performance sake */-->
<sly data-sly-call="${clientLib.css @ categories='my.category.author'}"
data-sly-test="${!wcmmode.preview}" />
</sly>
<!--/* You can also call ALL your code, both js and css */-->
<sly data-sly-call="${clientLib.all @ categories='some.category'}" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment