Bootstrap Bundle
Install
To install this bundle, please run, (*1)
$ composer require "pedroresende/bootstrapbundle"
Then run, (*2)
$ composer update
Add to AppKernel.php, (*3)
new PedroResende\BootstrapBundle\BootstrapBundle(),
Finally to routing.yml file, (*4)
bootstrap_public:
resource: "@BootstrapBundle/Resources/config/routing.yml"
prefix: /bootstrap_bundle
Install assets, (*5)
$ php app/console assets:install --symlink
Assetic dump, (*6)
$ php app/console assetic:dump
To use in your templates, (*7)
CSS
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% stylesheets output='css/bootstrap.min.css'
'@bootstrap_css' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" type="text/css"/>
{% endstylesheets %}
JS
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
{% javascripts output='js/bootstrap.min.js'
'@bootstrap_js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
You can always simply extend the existing template by using, (*8)
{% extends 'BootstrapBundle::layout.html.twig' %}
{% block body %}
{% block container %}{% endblock %}
{% endblock %}