BraincraftedBootstrap for Symfony(Assetic管理方式)

1. 依赖包管理

Composer 添加以下包结构:

{
    "require": {
        "braincrafted/bootstrap-bundle": "~2.0",
        "twbs/bootstrap": "3.0.*",
        "jquery/jquery":  "1.11.*",
        "leafo/lessphp": "0.4.0",
        "knplabs/knp-paginator-bundle": "2.4.0"
    },
    // !!!这里的两行注释不可以被添加到composer.json内,否则会报错
    // 临时创建新的 composer repositories
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jquery/jquery",
                "version": "1.11.0",
                "dist": {
                    "url": "http://code.jquery.com/jquery-1.11.0.min.js",
                    "type": "file"
                }
            }
        }
    ]
}

2. 依赖包配置

<?php

// app/AppKernel.php
new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(),
# app/config/config.yml
assetic:
    filters:
        lessphp:
             file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php
             apply_to: "\.less$"
        cssrewrite: ~
braincrafted_bootstrap:
    assets_dir: %kernel.root_dir%/../vendor/twbs/bootstrap
    jquery_path: %kernel.root_dir%/../vendor/jquery/jquery/jquery-1.11.0.js
    less_filter: lessphp

官方指南(深究再看)

安装要求

  • PHP 5.3.3 及以上
  • Symfony 2.3 及以上
  • Twig 1.11 及以上
  • AsseticBundle 2.3 及以上(可选项,强烈推荐)

另外你应该安装的包:

  • KnpMenuBundle
  • KnpPaginatorBundle
  • lessphp 0.4.0

[建议包版本参考链接](http://bootstrap.braincrafted.com/getting-
started.html#requirements)

    原文作者:吴启成
    原文地址: https://segmentfault.com/a/1190000000432375
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞