This extension sets up require js for use in your Yii project. Once installed you use a widget in a view or layout to setup require and then you can use require js as you normally would starting at an entry script (usually main.js) where you can load further modules and dependencies etc.
How to Use:
- Place the yii-require-js folder in your extensions directory
- Use the widget in any view that you want to use require js
- Create main.js in /protected/components/js/ and start coding js
If you would prefer a different js starting point instead of main.js define this in your main.php file like so:
'params' => array( 'yii-require-js'=>array( 'initialModule' => 'myModule' ),
If you would prefer to load your scripts from another directory other than /protected/components/js you can define this in your main.php config like so:
'params' => array( 'yii-require-js'=>array( 'scriptsDirectory' => 'application.components.js.requireModules' ), ...
This project makes use of RequireJS. Located here: http://requirejs.org/