Javascript & Publishing

I have a few doubts with regard to using js and publishing them.

Is it better, performance-wise, to have some js inserted through the means of using registerScript() or having an external js, if the script is little huge, like more than 500 lines of code?

Is it possible to send php variables to an external js, such as the YII CSRF variable, or the YII-generated URL used for jquery ajax? Because, i often land up using inline js just for these two purposes.

Is it a standard practice to use the external js by publishing via assetManager or do people more often have it in a web-accessible folder?

Thx…

mohit

Is it possible to send php variables to an external js, such as the YII CSRF variable - yes it is possible. the value of yii csrf is in a hidden field as part of a form

Is it a standard practice to use the external js by publishing via assetManager or do people more often have it in a web-accessible folder? - I’ve used both and both work fine. assets guarantee you you will not publish duplicate content

Thx for reply…