I am becoming addicted to Symfony's separation of concerns, and I'd like to extend this philosophy to my Javascript. I am finding the view layers in my projects to be very reasonable divisions for related Javascript functionality.
What's the best way to organize & separate my Javascript? Ideally, I'd like to be able to add view-specific Javascript. I'm almost certain embedding the JS directly into the template is bad practice. I also know that adding a new script tag in each view is costly to the client.
What's the correct approach here?