0

In reference to the following post:

Using javascript in Symfony2/Twig

Is there a possibility to include scripts locating on other servers, just as google-api.

2 Answers 2

1

The fact that the script is located on an external server doesn't change much. You can still have Assetic handle it like in the example below.

{% block javascripts %}

  {% javascripts 
    'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'
    '@AcmeDemoBundle/Resources/public/js/demo.js'
  %}

    <script src="{{ asset_url }}"></script>

  {% endjavascripts %}

{% endblock %}
Sign up to request clarification or add additional context in comments.

2 Comments

In my Project Assetic converts the external URL to an internal: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js' results in <script type="text/javascript" src="/js/2bec354_jquery-ui.min_1.js"></script>
Assetic not only convert, Assetic download and save external script to local path.
-1

I solved it without the asset-manager,
just including the script statically.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.