2017 © Pedro Peláez
 

symfony-bundle bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

image

pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  • Friday, September 25, 2015
  • by pinano
  • Repository
  • 3 Watchers
  • 5 Stars
  • 3,374 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 7 Versions
  • 1 % Grown

The README.md

Twitter Bootstrap 3 Bundle for Symfony2

Current Version

Bootstrap 3.3.5, (*1)

Installation

Add bundle to your composer.json file

``` js // composer.json, (*2)

{ "require": { // ... "pinano/bootstrap3-bundle": "dev-master" } }, (*3)


### Or, if you prefer, choose a specific version ``` js // composer.json { "require": { // ... "pinano/bootstrap3-bundle": "3.3.5" } }

Add bundle to your application kernel

``` php // app/AppKernel.php, (*4)

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


### Download the bundle using Composer ``` bash $ php composer.phar update pinano/bootstrap3-bundle

Install assets

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

``` bash $ php app/console assets:install web, (*7)


Optionally, use the --symlink attribute to create links rather than copies of the resources ``` bash $ 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., (*8)

Note: Bootstrap 3 javascript resources require that you have previously loaded jQuery library., (*9)

``` twig {% block javascripts %} {% javascripts ... '@PinanoBootstrap3Bundle/Resources/public/js/bootstrap.js' ... %} {% endjavascripts %} {% endblock %}, (*10)


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.. ``` twig {% 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: twig {% 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 %}, (*11)

Note: See https://github.com/kriswallsmith/assetic/issues/53 for known limitations of assetic with CSS referencing., (*12)

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., (*13)

The folks at Sensio Labs have already covered this approach and you can check it in their documentation., (*14)

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., (*15)

References

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

The Versions

25/09 2015

dev-master

9999999-dev http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

12/11 2014

3.3.0

3.3.0.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

04/02 2014

3.1.0

3.1.0.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

10/12 2013

3.0.3

3.0.3.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

07/11 2013

3.0.2

3.0.2.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

04/11 2013

3.0.1

3.0.1.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle

03/09 2013

3.0.0

3.0.0.0 http://github.com/pinano/bootstrap3-bundle

Symfony2 bundle for wrapping Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

bootstrap bootstrap3 bundle