spoonx/sxbootstrap

基于 rwoverdijk/assetmanager 的 ZF2 (zend framework 2) 的 twitter bootstrap 模块

2.2.0 2013-10-29 12:06 UTC

README

本模块提供视图助手,使您能够轻松地使用 twitter bootstrap。本模块还允许您使用 AssetManager 模块 来构建、缓存、修改和扩展 twitter bootstrap。

注意

bootstrap 3.0 的支持正在积极开发中。您可以通过查看 3.0.0 分支来帮助和测试。

安装 ViewHelpers

如何安装?

将需求添加到您的 composer.json 文件中

./composer.phar require spoonx/sxbootstrap
# When asked for a version, type: "2.*"

安装 Font Awesome

如何安装?

  1. 将依赖项添加到您的 composer.json 文件中

    ./composer.phar require fortawesome/font-awesome
    # When asked for a version, type: "3.*"
  2. 通过在 config/autoload/sxbootstrap.local.php 中添加以下内容来启用 Font Awesome 的使用

    <?php
    return array(
        'twitter_bootstrap' => array(
            'use_font_awesome' => true,
        ),
    );

安装渲染器(推荐)

如何安装?

  1. 将依赖项添加到您的 composer.less 文件中

    ./composer.phar require rwoverdijk/assetmanager twbs/bootstrap
    # When asked for a version, type: "1.*" for assetmanager and "2.*" for bootstrap.
  2. 在您的 application.config.php 配置文件中启用 AssetManagerSxBootstrap

  3. 安装 less...

    a) 通过 NPM/Node.js (推荐方法)

    1. Install npm/node.js. [Instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) can be found here.
    2. To Install lessc, open up your command line, and navigate to your project (`cd /path/to/my/project`).
    3. Once you get there, run the following command: `npm install less .` (including the dot).
    

    b) 通过 lessphp (不推荐)

    **Add the requirement**
    
    ```bash
    ./composer.phar require leafo/lessphp
    # When asked for a version, type: "0.*"
    ```
    
    Then add the following config to your application's module.config.php:
    
    ```php
    'twitter_bootstrap' => array(
        'use_lessphp' => true,
    ),
    ```
    
  4. 配置过滤器以使其工作。(这仅适用于您使用 node.js 且二进制文件不在 /usr/bin/node 中,或者您的 node 路径不是默认路径,因此您已忽略我在步骤 3a 中的建议。)

  5. 查看 wiki 以获取示例和其他信息以开始。特别是关于 如何配置过滤器以使其工作(页面底部) 的部分

好吧... 为什么?

渲染器有很多优点。

功能

  • 简单的强大表单
  • 新增 可选的 Font Awesome 集成
  • 新增 添加加载路径
  • 新增 添加自定义组件
  • 可定制(变量、组件、插件)
  • 与 AssetManager 兼容
  • 丰富的 ViewHelpers
  • 可扩展(从 bootstrap 上下文运行您自己的 less 文件以共享 mixins 和变量)
  • 已与 twitter bootstrap 2.3+ 测试(较旧版本也可能工作)
  • 您可以选择使用 lessphp(不推荐)

用法

查看 vendor/spoonx/sxbootstrap/config 中的 config/sxbootstrap.local.php.dist 文件以获取配置选项和信息。另外,请查看 wiki

问题/支持

如果您在使用模块时遇到困难,以下是一些可能有助于您解决问题的资源。