定制 gintonicweb/requirejs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gintonicweb/requirejs

最新稳定版本:0.2.2

Composer 安装命令:

composer require gintonicweb/requirejs

包简介

Requirejs helper for CakePHP

README 文档

README

Build Status codecov.io Packagist Software License

Require plugin for CakePHP

Load javascript modules (AMD) asynchroneously from anywhere in your views via requirejs.

Installation

Install the plugin using composer.

"gintonicweb/requirejs": "~0.2"

Load it in config/bootstrap.php

Plugin::load('Requirejs');

Example

Load this helper from your controller and define your config options.

  • require the basepath where requirejs library can be found (optional)
  • configFiles requirejs configuration files (optional)
  • inlineConfig inline configuration options, echoed as an inline config file (optional)
public $helpers = [
    'Requirejs.Require' => [
        'require' => 'myrequire',
        'configFiles' => [
            'myconfig',
            'Someplugin.config',
        ],
        'inlineConfig' => [
            'baseUrl' => '/',
            'urlArgs' => 'bust=0',
        ],
    ],
];

Here's how load javascript modules. CakePHP plugin notation is supported. When no plugins are defined, the module name is passed as-is to requirejs, allowing you to handle the path the way you like in your own config.js. Once in your template, call load() to load the requirejs lib. It's also possible to pass an array of additional config modules to the load method if needed.

<?= $require->module('Requirejs.app/demo') ?>
<?= $require->module('test/demo') ?>
<?= $require->load() ?>

统计信息

  • 总下载量: 825
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-11