Minimalist Twitter Bootstrap Symfony 2 Bundle

I was looking for a minimalist way to use Twitter Bootstrap and Symfony 2 in a clean way. The solution I came up with is as follows:

  1. Create a new bundle.
  2. Register the bundle.
  3. Deploy the resources.

Create a new bundle

I created my bundle by hand, omitting some of the stuff you get when you generate the bundle via php app/console generate:bundle. The folder structure underneath the src directory looks as follows:

-- Acme
   |-- TwitterBundle
       |-- Resources
       |   |--public
       |      |--[TwitterBootstrapFiles]
       |-- AcmeTwitterBundle.php

The content of AcmeTwitterBundle.php is:


namespace Acme\TwitterBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeTwitterBundle extends Bundle

Register the bundle

To register the bundle add new Acme\TwitterBundle\OnTimeTwitterBundle() to the $bundles array in app/AppKernel::registerBundles().

Deploy the resources

To deploy the files just execute php app/console assets:install --symlink web/.

Tags: ,

The comment form is closed.