Skip to content

Configuration options

Wesley Overdijk edited this page Sep 27, 2013 · 7 revisions

There's quite a lot you can configure in this module. Here's an overview of the options that are available to you:

<?php
array(
    'twitter_bootstrap' => array(
        'variables'             => array(),
        'included_components'   => array(),
        'excluded_components'   => array(),
        'included_plugins'      => array(),
        'excluded_plugins'      => array(),
        'plugin_alias'          => 'js/bootstrap.js',
        'filter'                => array( 
            'node_paths'    => array(),
        ),
    ),
);

variables

These are the variables you can find on the customization page of twitter bootstrap and in the twitter/bootstrap/less/variables.less file. You can also find all available variables for twitter bootstrap 2.3.0 here. You can overwrite these variables by simply supplying them in an array. Here's an example:

<?php
return array(
    'twitter_bootstrap' => array(
        'variables' => array(
            'bodyBackground' => '#ededed',
            'textColor'      => '#8e8e8e',
        ),
    ),
);

use_font_awesome

This option allows you to enable Font Awesome. When enabled, all you have to do is add the Font Awesome dependency to your composer.json.

"fortawesome/font-awesome": "3.*"

load_paths

This option expects an array of load paths. These paths will be added for every file that has the bootstrap filter applied to it, allowing you to include less files from these locations, too.

By default the only two loadPaths are those of the asset being loaded, and twitter bootstrap.

custom_components

The Custom components option allows you to specify an array of files that should be added to the bootstrap.css build when using the bootstrap asset helper. This is especially useful when writing plugins for twitter bootstrap.

Note: Don't forget to add the loadPath for the component you're adding.

included_components

This configuration option allows you to include (whitelist) components by name. This means that it will by default, not include any other component besides the ones you've defined. If it's not working, you might have forgotten to include a specific file. (variables.less gets included by default, but mixins doesn't.)

Here's an example:

<?php
return array(
    'twitter_bootstrap' => array(
        'included_components' => array(
            'reset.less',
        ),
    ),
);

excluded_components

This option is the same as the previous one, except that it doesn't include but exclude components (blacklist). This means that all components get included by default, except for the ones defined. FontAwesome is a realistic reason for you to want to use this and exclude the sprites. Here's an example:

<?php
return array(
    'twitter_bootstrap' => array(
        'excluded_components' => array(
            'sprites.less',
        ),
    ),
);

included_plugins

This option, again, is a lot like the previous two options. It allows you to include (whitelist) jquery plugins as packaged with twitter bootstrap. Normally, you'd have to use the format bootstrap-pluginname.js, which I think is against the DRY principle. For that reason, you only have to supply the name of the the plugin. Here's an example:

<?php
return array(
    'twitter_bootstrap' => array(
        'included_plugins' => array(
            'transition',
            'button',
            'carousel',
        ),
    ),
);

excluded_plugins

This option allows you to exclude (blacklist) jquery plugins as packaged with twitter bootstrap. Normally, you'd have to use the format bootstrap-pluginname.js, which I think is against the DRY principle. For that reason, you only have to supply the name of the the plugin. Here's an example:

<?php
return array(
    'twitter_bootstrap' => array(
        'excluded_plugins' => array(
            'tab',
            'scrollspy',
            'modal',
        ),
    ),
);

plugin_alias

This option tells the module what to listen for when serving the plugins. If you (for some reason) wish to change this, it can be done with this option.

node_bin

When using the twitter bootstrap renderer bundled with the module, SxBootstrap depends on node.js. For that same reason, it must know where to find the node binary. If it's not in the default location (/usr/bin/node), you must configure this option.

Pro tip: You can find out where it's located by running which node.

node_paths

node.js has modules, and one of those modules is less. When using the twitter bootstrap renderer bundled with the module, SxBootstrap depends on less and must therefor be able to locate it. If it's not in the default path, add it by setting this value.

Pro tip: When setting up this module, follow the instructions in the readme. That way you won't be needing this option!.

Clone this wiki locally