Reputation: 455
I tried to integrate Twitter Bootstrap 3.2 on my Symfony 2.3 project.
Just found Tutorials for Bootstrap 3.0 with leafo/lessphp , but this is not supported anymore and in addition it is not working for Bootstrap 3.2 . I found nothing similar to leafo/lessphp that supports the latest Bootstrap version.
Is there any way to integrate Bootstrap 3.2 on a Symfony 2.3 project ?
Regards
Upvotes: 3
Views: 6932
Reputation: 105
symfony 2.6 Simple install and update via composer. It is just for fonts,css,js.
composer.json
"require": {
"twbs/bootstrap": "~3.3"
}
"post-install-cmd": [
"php -r \"if (!file_exists('web/bundles/bootstrap/')){ symlink(__DIR__.'/vendor/twbs/bootstrap/dist', 'web/bundles/bootstrap');}\""
]
"post-update-cmd": [
"php -r \"if (!file_exists('web/bundles/bootstrap/')){ symlink(__DIR__.'/vendor/twbs/bootstrap/dist', 'web/bundles/bootstrap');}\""
]
base.html.twig
<link href="{{ asset('bundles/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet"/>
<script src="{{ asset('bundles/bootstrap/js/bootstrap.min.js') }}"></script>
Then run command in web root
composer update twbs/*
Upvotes: 4
Reputation: 455
Sorry for being unclear. I'm using composer and config.yml to load the files.
I also took a look yesterday at the bundle (first result), but for bootstrap 3.0 there was an easy way to configure, so i asked myself if there was also an easy way to do it with bootstrap 3.2.
I don't want to include the js and css files manually, want to let this be done by composer / Symfony.
This was the way it worked with bootstrap 3.0:
http://mossco.co.uk/symfony-2/symfony-2-and-bootstrap-3-assetic-config-and-base-html-template-file/
As the less is not supported / developed anymore, it doesnt work for 3.2 bootstrap.
Hope the question is now clearly enough. If theres any approach without the bundle you'd really help me.
If this is the easiest and most reliable way: https://github.com/braincrafted/bootstrap-bundle i will use that bundle.
Upvotes: 0
Reputation: 179
You have just to include CSS and JS files in twig file like this :
<link rel="stylesheet" href="{{asset('bundles/bundleName/css/bootstrap.css')}}">
<script src="{{ asset('bundles/bundleName/js/bootstrap.min.js') }}" ></script>
Upvotes: 2
Reputation: 22817
It depends from what do you mean by integrating: if you mean just including the CSS and JS files, just download them,include them in your assets folder and require them from you templates.
If you want to have control over the way the LESS/SASSS source is generated, you may be interested on this bundle [which did magically show up as the first result after googling for "symfony bootstrap"].
Upvotes: 2