Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "simple_bootstrap"

Title:Bootstrap Extension to Simple Web
Rating:Not rated. Create the first rating!
Latest version:0.0.2
SHA1 sum:9eaec55f3b5bc071c18c1f89e94cd0cf69c9cd7b
Author:Paul Brown <paul@paulbrownmagic.com>
Home page:https://gitlab.com/PaulBrownMagic/simple_bootstrap
Download URL:https://gitlab.com/PaulBrownMagic/simple_bootstrap/*
Requires:simple_template
simple_web

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.194ae919d7085e6871fd03b774e06d8a8fc7cf8dc2https://gitlab.com/PaulBrownMagic/simple_bootstrap/-/archive/0.0.1/simple_bootstrap-0.0.1.zip
0.0.29eaec55f3b5bc071c18c1f89e94cd0cf69c9cd7b14https://gitlab.com/PaulBrownMagic/simple_bootstrap/-/archive/0.0.2/simple_bootstrap-0.0.2.zip

Simple Bootstrap

Make Simple Web Applications with Bootstrap!

This pack includes a bootstrap_base template and all the static files needed to kick start your Bootstrap 4, Simple Web application.

Included Blocks

Various elements can be overwritten in the templates, some require a file, and some can accept text. These are all set in the dict passed to reply_template/2 in simple web. If you declare your own, this will clobber the defaults in the base so you may wish to re-include some parts.

reply_template(bootstrap_base, data{html_attr:"lang=en", content:my_content_template}).

Text Blocks

  • title: You page title, eg: "My App!"
  • html_attrs: Attributes for your html tag, eg: "lang=en"
  • body_attrs: Attributes for your body tag, eg: 'class="dark"'

File Blocks

These are searched for relative to your template directory.

  • metas: Meta tags for your head
  • styles: Links to files to include in styles, don't forget this will clobber `<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">`
  • navbar: A block before the content for you to put your navbar.
  • content: The main content block, wrapped in a container.
  • scripts: A block to put your JavaScript links, not this will clobber all script tags for JQuery, Popper, and Bootstrap.

Re-Including the defaults

Sometimes you just want to add a stylesheet but include the default one too, same for scripts. You can include the defaults using a dynamic_include. Example styles:

{{ dynamic_include bootstrap("styles") }}
<link href="/static/css/my_styles.css rel="stylesheet">

Example scripts:

{{ dynamic_include bootstrap("scripts") }}
<script></script>

Same pattern will work for metas too.

Example Use

An example of how to use this package effectively can be found in Simple Web Examples: Bootstrap Templates.

Contents of pack "simple_bootstrap"

Pack contains 12 files holding a total of 282K bytes.