evheniy/twitter-bootstrap-bundle

The TwitterBootstrapBundle adds the ability to add latest Twitter Bootstrap to your application.

Installs: 4 396

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.4.0 2015-12-02 14:34 UTC

This package is not auto-updated.

Last update: 2024-04-13 13:51:54 UTC


README

knpbundles.com

Latest Stable Version Total Downloads Latest Unstable Version License

Build Status Coverage Status Scrutinizer Code Quality Build Status

This bundle provides TwitterBootstrap in Symfony2 from CDN maxcdn.bootstrapcdn.com

Documentation

You can change TwitterBootstrap version:

twitter_bootstrap:
    version: 3.3.4

You can set TwitterBootstrap local version (it helps if maxcdn doesn't work).

twitter_bootstrap:
    local_js: '@AppBundle/Resources/public/js/bootstrap.min.js'

Default value: '@TwitterBootstrapBundle/Resources/public/js/bootstrap.min.js'

twitter_bootstrap:
    local_fonts_dir: '@AppBundle/Resources/public/fonts/'

Default value: '@TwitterBootstrapBundle/Resources/public/fonts/'

twitter_bootstrap:
    local_css: '@AppBundle/Resources/public/css/bootstrap.min.css'

Default value: '@TwitterBootstrapBundle/Resources/public/css/bootstrap.min.css'

twitter_bootstrap:
    local_theme: '@AppBundle/Resources/public/css/bootstrap-theme.min.css'

Default value: '@TwitterBootstrapBundle/Resources/public/css/bootstrap-theme.min.css'

You can set local CDN:

twitter_bootstrap:
    local_cdn: 'cdn.domain.com'

You can use old html version:

twitter_bootstrap:
    html5: false

Default value: true. If false script will be with type="text/javascript"

You can use async loading:

twitter_bootstrap:
    async: true

Default value: false. If true script will be with async="async"

Installation

$ composer require evheniy/twitter-bootstrap-bundle "1.*"

Or add to composer.json

"evheniy/twitter-bootstrap-bundle": "1.*"

AppKernel:

public function registerBundles()
    {
        $bundles = array(
            ...
            new Evheniy\TwitterBootstrapBundle\TwitterBootstrapBundle(),
        );
        ...

config.yml:

#TwitterBootstrapBundle
twitter_bootstrap: ~

or

#TwitterBootstrapBundle
twitter_bootstrap:
    local_js: '@AppBundle/Resources/public/js/bootstrap.min.js'
    local_fonts_dir: '@AppBundle/Resources/public/fonts/'
    local_css: '@AppBundle/Resources/public/css/bootstrap.min.css'
    local_theme: '@AppBundle/Resources/public/css/bootstrap-theme.min.css'
    local_cdn: 'cdn.domain.com'
    version: 3.3.4
    html5: true
    async: false

And Assetic Configuration in config.yml:

#Assetic Configuration
assetic:
    bundles: [ TwitterBootstrapBundle ]

Add this string to your layout (styles and js)

<html>
    <head>
    ...

    {%- include "TwitterBootstrapBundle:TwitterBootstrap:css.html.twig" -%}
    </head>
    <body>
    ...

    {%- include "TwitterBootstrapBundle:TwitterBootstrap:js.html.twig" -%}
    </body>
</html>

The last step

app/console assetic:dump --env=prod --no-debug

License

This bundle is under the MIT license.

Документация на русском языке

TwitterBootstrap