Add requirements to composer.json:
{
"require" : {
"apnet/bootstrap" : "~3.1,<4.0"
}
}
Register ApnetAsseticImporterBundle
bundle in the AppKernel.php
file
// ...other bundles ...
$bundles[] = new Apnet\AsseticImporterBundle\ApnetAsseticImporterBundle();
Add Bootstrap importer to services.yml
services:
# bootstrap3 default css
apnet.assetic.importer.bootstrap_css:
parent: assetic.importer_path
arguments:
- %kernel.root_dir%/../vendor/apnet/bootstrap/app/Resources/assets/stylesheets
- bootstrap
tags:
- { name: apnet.assetic.config_mapper }
# bootstrap3 js
apnet.assetic.importer.bootstrap_js:
parent: assetic.importer_path
arguments:
- %kernel.root_dir%/../vendor/apnet/bootstrap/app/Resources/assets/javascripts
- bootstrap
tags:
- { name: apnet.assetic.config_mapper }
To include Bootstrap into Twig template use imported_asset function:
<link href="{{ imported_asset('bootstrap/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
and
<script type="text/javascript" src="{{ imported_asset('bootstrap/bootstrap.min.js') }}"></script>