I need to generate a dynamic JSON object using some twig function like asset and translate. I'd like to put it in an external settings.js file. I may use include 'settings.js.twig' and put the relevant code in it.
Is this the correct way of generating dynamic javascript in Symfony 2?