Skip to content

Instantly share code, notes, and snippets.

@jbalthis
Created April 30, 2014 19:47
Show Gist options
  • Save jbalthis/6e4d1c669178a18d8cec to your computer and use it in GitHub Desktop.
Save jbalthis/6e4d1c669178a18d8cec to your computer and use it in GitHub Desktop.
An example of how to include JavaScript in a Twig template
{# An example of how to include JavaScript in a Twig template #}
{# This example includes yuicompression, as well jquery, jquery-ui, and bootstrap integration #}
{# Also includes an inline js example and is perfectly suited for assetic management #}
{# BEGIN CODE #}
{% block footer_scripts %}
{% javascripts
'js/jquery.js'
'js/jquery-ui.js'
'js/bootstrap.js'
filter='yui_js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
});
</script>
{% endblock footer_scripts %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment