Module reahl.web.libraries

Added in version 3.2.

Reahl uses CSS and JavaScript from other projects. The CSS and JavaScript world has its own ecosystem of tools that allow you to do various things, for example:

  • Compile your own customised CSS using a CSS preprocessor like Sass

  • Manage the versions and interdependencies of such projects.

  • Some code is hosted on Content Delivery Networks (CDNs).

  • Some code is minified.

This module is a start towards supporting such “front-end frameworks” which Reahl depends upon. By default, Reahl merely includes the correct versions of the front-end libraries it needs.

Reahl also contains its own JavaScript and CSS code. Where we do this, our own code is also managed using this same infrastructure.

If you write your own Widgets that make use of CSS or JavaScript, creating a Library and configure your site to use it.

LibraryIndex

class reahl.web.libraries.LibraryIndex(*libraries)

Bases: object

An ordered collection of Library instances.

A LibraryIndex instance is available in the configuration as web.config.frontend_libraries. All the Library instances contained in web.config.frontend_libraries are included on any HTML5Page.

Libraries in a LibraryIndex are included on a page in the order that they appear in the LibraryIndex.

Parameters:

librariesLibrary instances (in order) to initialise this LibraryIndex with.

clear()

Removes all Libraries from the list.

add(library)

Adds a Library to the end of the list.

__contains__(name)

An implementation of the in operator, so that one can ask whether a library with given name is in this index.

Parameters:

name – The unique name of the Library to check for.

Library

class reahl.web.libraries.Library(name)

Bases: object

A frontend-library: a collection of CSS and JavaScript code that can be used with Reahl.

To create your own Library, subclass from this class and set its attributes to indicate which files to include as part of it and where to find them.

To use a library, add it to the web.config.frontend_libraries config setting. The CSS and JavaScript files of all such configured libraries are automatically included in any HTML5Page.

Parameters:

name – A unique name for this Library.

name

The unique name of this Library

egg_name

The component (egg) that contains the files of this library

shipped_in_package

The package that contains the files of this library

files

The JavaScript and CSS files that form part of this library (relative to the shipped_in_package)

Reahl

class reahl.web.libraries.Reahl

Bases: Library

JavaScript and CSS that is part of Reahl itself.

JQuery

class reahl.web.libraries.JQuery

Bases: Library

Version 3.7.1 of JQuery.

This Library also includes a number of plugins we use internally:

Plugin

Version

jquery.validate

1.19.5 (a heavily modified version) (https://github.com/jquery-validation/jquery-validation/releases/tag/1.19.5)

jquery.ba-bbq

1.3pre

jquery.blockUI

2.70.0 (https://github.com/malsup/blockui/releases)

jquery.form

4.3.0 (https://github.com/jquery-form/form/releases)

Bootstrap4

class reahl.web.libraries.Bootstrap4

Bases: Library

Version 4.6.2 of Bootstrap.

ReahlBootstrap4Additions

class reahl.web.libraries.ReahlBootstrap4Additions

Bases: Library

Reahl specific JavaScript and CSS for use with Bootstrap4.

HTML5Shiv

class reahl.web.libraries.HTML5Shiv

Bases: Library

Version 3.7.3 of html5shiv.

IE9

class reahl.web.libraries.IE9

Bases: Library

Version 2.1(beta4) of IE9.js.

Holder

class reahl.web.libraries.Holder

Bases: Library

Version 2.9.9 of Holder.

Popper

class reahl.web.libraries.Popper

Bases: Library

Version 1.16.1 (umd) of Popper.

JQueryUI

class reahl.web.libraries.JQueryUI

Bases: Library

A heavily customised subset of version 1.13.2 of JQuery UI.

Only contains the Widget Factory and :tabbable, :focusable Selector.