Yii 1.1: yii-require-js

A Small extension to help integrate Require JS into Yii projects

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:

  1. Place the yii-require-js folder in your extensions directory
  2. Use the widget in any view that you want to use require js
  3. 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(
           '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(
          'scriptsDirectory' => 'application.components.js.requireModules'
       ), ...


This project makes use of RequireJS. Located here: http://requirejs.org/

Total 1 comment

#12251 report it
Cherif at 2013/03/09 04:51pm

Hi, thank you for this extensions, I do not play with it yet, but just a question did you think to build it? as a component maybe better?

Leave a comment

Please to leave your comment.

Create extension