1

I understand the general concept of assetic, which makes sense for site-wide script resources, but what about the javascript that is specific to one page or controller? How do you structure those, where would one keep them, and then how would they be added to the templates?

1
  • This is an open issue in the Symfony community. People handle it in many different way. AFAIK there is no official way. Commented Aug 21, 2014 at 10:09

1 Answer 1

1

Typically what I do is create a 'controllers' folder inside my Resources\public\js folder and then create a file with the same name as the controller it's going to be used in. Then all you need to do in your twig template is include the file using the assetic <% javascripts %><% endjavascripts %> tag.

Sign up to request clarification or add additional context in comments.

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.