title: Including Js in twig template
body: <p>I am trying to build a simple contacts app using Backbone js to learn backbone.I am using symphony to serve the page.But i am not able to include the app.js file in my twig template.Here are my files :</p>
  
  <p><strong>index.html.twig</strong></p>
  
  <pre><code>{% extends 'base.html.twig' %}
  
      {% block javascripts %}
        {{ parent() }}
        &lt;script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script src = "http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"&gt;&lt;/script&gt;
        &lt;script src = "http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"&gt;&lt;/script&gt;
  
      {% endblock %}
      {% block body %}
        &lt;meta charset="UTF-8" /&gt;
        &lt;title&gt;Backbone.js Web App changed&lt;/title&gt;
  
  
        &lt;div id = 'contacts'&gt;
        &lt;script id = "contactTemplate" type="text/template"&gt;
          &lt;img src = "&lt;%= photo %&gt;" alt ="&lt;%= name %&gt;"&gt;
          &lt;h1&gt;Name : &lt;%= name %&gt;&lt;span&gt;&lt;%= type %&gt;&lt;/span&gt;&lt;/h1&gt;
          &lt;div&gt;&lt;%= address%&gt;&lt;/div&gt;
          &lt;dl&gt;
            &lt;dt&gt;Tel: &lt;/dt&gt;&lt;dd&gt; &lt;%= tel%&gt;&lt;/dd&gt;
            &lt;dt&gt;Email: &lt;/dt&gt;&lt;dd&gt; &lt;%= email%&gt;&lt;/dd&gt;
          &lt;/dl&gt;
        &lt;/script&gt;
        &lt;/div&gt;
    {% endblock %}
  </code></pre>
  
  <p><strong>base.html.twig</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8" /&gt;
          &lt;title&gt;{% block title %}Welcome!{% endblock %}&lt;/title&gt;
  
  
          {% block javascripts %}
              &lt;script src="{{ asset('js/app.js') }}"&gt;&lt;/script&gt;
              &lt;script src="{{ asset('js/json2.js') }}"&gt;&lt;/script&gt;
          {% endblock %}
      &lt;/head&gt;
      &lt;body&gt;
          {% block body %}{% endblock %}
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>/**
   * @Route("/index", name="index")
   */
  public function indexPage()
  {
    return $this-&gt;render('default/index.html.twig');
  }
  </code></pre>
  
  <p>I have run the server and navigated to </p>
  
  <pre><code>http://localhost:8000/index
  </code></pre>
  
  <p>THe console shows the following error</p>
  
  <pre><code>Get http://localhost:8000/js/app.js
  Get http://localhost:8000/js/json2.js
  </code></pre>
  
  <p>And the source code in console is :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8" /&gt;
          &lt;title&gt;Welcome!&lt;/title&gt;
  
  
                            &lt;script src="/js/app.js"&gt;&lt;/script&gt;
                            &lt;script src="/js/json2.js"&gt;&lt;/script&gt;
  
        &lt;script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script src = "http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"&gt;&lt;/script&gt;
        &lt;script src = "http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"&gt;&lt;/script&gt;
  
          &lt;/head&gt;
      &lt;body&gt;
                &lt;meta charset="UTF-8" /&gt;
        &lt;title&gt;Backbone.js Web App changed&lt;/title&gt;
  
  
        &lt;div id = 'contacts'&gt;
  
  
  
  
  
  
        &lt;script id = "contactTemplate" type="text/template"&gt;
          &lt;img src = "&lt;%= photo %&gt;" alt ="&lt;%= name %&gt;"&gt;
          &lt;h1&gt;Name : &lt;%= name %&gt;&lt;span&gt;&lt;%= type %&gt;&lt;/span&gt;&lt;/h1&gt;
          &lt;div&gt;&lt;%= address%&gt;&lt;/div&gt;
          &lt;dl&gt;
            &lt;dt&gt;Tel: &lt;/dt&gt;&lt;dd&gt; &lt;%= tel%&gt;&lt;/dd&gt;
            &lt;dt&gt;Email: &lt;/dt&gt;&lt;dd&gt; &lt;%= email%&gt;&lt;/dd&gt;
          &lt;/dl&gt;
        &lt;/script&gt;
        &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It shows error at line </p>
  
  <pre><code>  &lt;script src="/js/app.js"&gt;&lt;/script&gt;
    &lt;script src="/js/json2.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>And finally my directory structure is :</p>
  
  <p><img src="https://i.stack.imgur.com/DNkuk.png" alt="Directory structure"></p>
  
  <p>EDIT :
  Changed my file structure :
  <img src="https://i.stack.imgur.com/JqykS.png" alt="enter image description here">
   And base.html changed to</p>
  
  <pre><code>{% block javascripts %}
              &lt;script src="{{ asset('ormproject/app/Resources/assets/js/app.js') }}"&gt;&lt;/script&gt;
              &lt;script src="{{ asset('ormproject/app/Resources/assets/js/json2.js') }}"&gt;&lt;/script&gt;
          {% endblock %}
  </code></pre>