pinano/bootstrap3-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pinano/bootstrap3-bundle

Composer 安装命令:

composer require pinano/bootstrap3-bundle

包简介

Symfony2 bundle for wrapping Twitter Bootstrap 3

README 文档

README

Current Version

Bootstrap 3.3.5

Installation

Add bundle to your composer.json file

// composer.json

{
    "require": {
        // ...
        "pinano/bootstrap3-bundle": "dev-master"
    }
}

Or, if you prefer, choose a specific version

// composer.json

{
    "require": {
        // ...
        "pinano/bootstrap3-bundle": "3.3.5"
    }
}

Add bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Pinano\Bootstrap3Bundle\PinanoBootstrap3Bundle(),
        // ...
    );
}

Download the bundle using Composer

$ php composer.phar update pinano/bootstrap3-bundle

Install assets

Given your server's public directory is named "web", install the public vendor resources

$ php app/console assets:install web

Optionally, use the --symlink attribute to create links rather than copies of the resources

$ php app/console assets:install --symlink web

Usage

Once all the resources are in place, if you want to use the Bootstrap 3 javascript features (modals, dropdowns, etc.) you can edit any of your twig views or layouts to include the Bootstrap3 javascript files. If you don't want to use any of these features you can skip this step. Please refer to the Bootstrap 3 documentation to see what features are available.

Note: Bootstrap 3 javascript resources require that you have previously loaded jQuery library.

{% block javascripts %}
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    {% javascripts
        ...
        '@PinanoBootstrap3Bundle/Resources/public/js/bootstrap.js'
        ...
        %}
        <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

Then you will want to load the css resources to take advantage of the grid and all the responsive utilities.

Note: The bootstrap-theme.css file is optional and is only intended to make Bootstrap 3 look nice out-of-the-box..

{% block stylesheets %}
    {% stylesheets filter='cssrewrite'
      ...
      'bundles/pinanobootstrap3/css/bootstrap.css'
      'bundles/pinanobootstrap3/css/bootstrap-theme.css'
      ...
      'bundles/yourawesomebundle/css/awesomestylesheet.css'
      ...
    %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

If you want to create your own SCSS mix-ins or variables, you should import Bootstrap 3 SCSS files instead of the CSSs and create a css output using any of the SCSS filters available for assetic:

{% block stylesheets %}
    {% stylesheets filter='cssrewrite,scss'
      ...
      'bundles/pinanobootstrap3/scss/_bootstrap.scss'
      'bundles/pinanobootstrap3/scss/bootstrap/_theme.scss'
      ...
      'bundles/yourawesomebundle/scss/awesomestylesheet.scss'
      ...
    %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

Note: See kriswallsmith/assetic#53 for known limitations of assetic with CSS referencing.

I usually follow a simple inheritance schema when it comes to designing twig templates. That is, I have an app/Resources/views/base.html.twig file that I use as a site-wide template. Then, inside every bundle I have my own Resources/views/layout.html.twig file that extends the base template. Depending on the kind of application I'm designing I can place the Bootstrap stuff in the site-wide or the bundle-wide template. Then every view of a given bundle will extend the corresponding bundle layout.html.twig file, which in turn extends the site-wide template.

The folks at Sensio Labs have already covered this approach and you can check it in their documentation.

Licenses

I do not own Bootstrap 3 files at all, I'm just providing a Bundle package to easy-install them all. Refer to the source code of the included files from Bootstrap 3 for license information.

References

  1. http://getbootstrap.com/
  2. http://symfony.com

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 2
  • 开发语言: CSS

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-09-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固