yii-require-js A Small extension to help integrate Require JS into Yii projects

  1. Usage
  2. Resources

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.

Usage

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

eg:

$this->widget('ext.yii-require-js.YiiRequireJsWidget');

Config:

If you would prefer a different js starting point instead of main.js define this in your main.php file like so:

eg:

'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:

eg:

'params' => array(
       'yii-require-js'=>array(
          'scriptsDirectory' => 'application.components.js.requireModules'
       ), ...

Resources

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

0 0
5 followers
609 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: Richard Walker
Created on: Jun 13, 2012
Last updated: 5 years ago

Downloads

show all