I'm wondering - why do you want to do this in the first place? I don't understand what's the reason of not willing to include JS file as it's done normally. Why do you need to include content of JS file like that?
Thanks, This is the final results. public function actionRenderJS() { header("Content-type: text/javascript"); $js_file = 'scripts/widget.js'; $this->renderFile($js_file); Yii::app()->end(); }
registerScript()file_get_contents()and use its output inregisterScript()<script src="..."></script>tag to the view?