The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojolicious::Plugin::Bootstrap3 - Mojolicious + http://getbootstrap.com/

VERSION

3.1005

DESCRIPTION

Mojolicious::Plugin::Bootstrap3 is used to include http://getbootstrap.com/ CSS and JavaScript files into your project.

This is done with the help of Mojolicious::Plugin::AssetPack and sass. Sass is required to do modifications to the css pack.

SYNOPSIS

  use Mojolicious::Lite;
  plugin 'bootstrap';
  get '/' => 'index';
  app->start;

  __END__
  @@ index.html.ep
  %= asset 'bootstrap.css';
  %= asset 'bootstrap.js';
  <p class="alert alert-danger">Danger, danger! Hight Voltage!</p>

TIP! You might want to load Mojolicious::Plugin::AssetPack yourself to specify options.

STATIC FILE STRUCTURE

You can replace any of these static files in your own project.

public/sass/bootstrap.scss and public/sass/bootstrap/_variables.scss are probably the files that you want to replace, to make the generated bootstrap file smaller and more personal.

  font/glyphicons-halflings-regular.eot
  font/glyphicons-halflings-regular.svg
  font/glyphicons-halflings-regular.ttf
  font/glyphicons-halflings-regular.woff
  js/bootstrap/affix.js
  js/bootstrap/alert.js
  js/bootstrap/button.js
  js/bootstrap/carousel.js
  js/bootstrap/collapse.js
  js/bootstrap/dropdown.js
  js/bootstrap/modal.js
  js/bootstrap/popover.js
  js/bootstrap/scrollspy.js
  js/bootstrap/tab.js
  js/bootstrap/tooltip.js
  js/bootstrap/transition.js
  js/jquery-1.11.0.min.js
  sass/bootstrap.scss
  sass/bootstrap/_alerts.scss
  sass/bootstrap/_badges.scss
  sass/bootstrap/_breadcrumbs.scss
  sass/bootstrap/_button-groups.scss
  sass/bootstrap/_buttons.scss
  sass/bootstrap/_carousel.scss
  sass/bootstrap/_close.scss
  sass/bootstrap/_code.scss
  sass/bootstrap/_component-animations.scss
  sass/bootstrap/_dropdowns.scss
  sass/bootstrap/_field-with-error.scss
  sass/bootstrap/_forms.scss
  sass/bootstrap/_glyphicons.scss
  sass/bootstrap/_grid.scss
  sass/bootstrap/_input-groups.scss
  sass/bootstrap/_jumbotron.scss
  sass/bootstrap/_labels.scss
  sass/bootstrap/_list-group.scss
  sass/bootstrap/_media.scss
  sass/bootstrap/_mixins.scss
  sass/bootstrap/_modals.scss
  sass/bootstrap/_navbar.scss
  sass/bootstrap/_navs.scss
  sass/bootstrap/_normalize.scss
  sass/bootstrap/_pager.scss
  sass/bootstrap/_pagination.scss
  sass/bootstrap/_panels.scss
  sass/bootstrap/_popovers.scss
  sass/bootstrap/_print.scss
  sass/bootstrap/_progress-bars.scss
  sass/bootstrap/_responsive-utilities.scss
  sass/bootstrap/_scaffolding.scss
  sass/bootstrap/_tables.scss
  sass/bootstrap/_theme.scss
  sass/bootstrap/_thumbnails.scss
  sass/bootstrap/_tooltip.scss
  sass/bootstrap/_type.scss
  sass/bootstrap/_utilities.scss
  sass/bootstrap/_variables.scss
  sass/bootstrap/_wells.scss

Non-standard files

Some of the static files are not bundled with the original Bootstrap distribution.

  • js/jquery-1.11.0.min.js

    The jQuery bundled with this distribution will always be compatible with the Bootstrap javascript files. It might change minor version, but it is very unlikely that it will change much. Exceptions from this rule is if the Bootstrap javascripts should require a newer version to function properly.

  • sass/bootstrap/_field-with-error.scss

    This SASS file need to be included manually. It is used to style .field-with-error tags, the same way as .has-error.

    Example of markup that will be styled on invalid input:

      <div class="form-group">
        %= label_for 'username', 'Username', class => 'col-sm-2 control-label'
        <div class="col-sm-4">
          %= text_field 'username', class => 'form-control'
        </div>
      </div>

    This is EXPERIMENTAL and subject to change.

METHODS

asset_path

  $path = Mojolicious::Plugin::Bootstrap3->asset_path($type);
  $path = $self->asset_path($type);

Returns the base path to the assets bundled with this module.

Set $type to "sass" if you want a return value that is suitable for the SASS_PATH environment variable.

register

  $app->plugin(
    bootstrap => {
      css => [qw( bootstrap.scss )],
      js => [qw( button.js collapse.js ... )],
      jquery => $bool, # default true
    },
  );

Default values:

  • css

    bootstrap.scss.

    The name of the files to include in the asset named bootstrap.css.

    Specify an empty list to disable building bootstrap.css.

  • js

    affix.js, alert.js, button.js, carousel.js, collapse.js, dropdown.js, modal.js, popover.js, scrollspy.js, tab.js, tooltip.js and transition.js.

    The name of the files to include in the asset named bootstrap.js.

    Specify an empty list to disable building bootstrap.css.

    NOTE! This list might change, but will include all the javascripts available in the current version.

  • jquery

    This will include the bundled jQuery version in the bootstrap.js asset. Set this to 0 if you include your own jQuery.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org