Module reahl.web.libraries

New 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. Currently, Reahl merely includes the correct versions of the front-end libraries it needs and a user is not able to customise these in any way. In the future we hope to extend this infrastructure to be able to make use of everything the JavaScript / CSS tool ecosystem offers.

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 is the way to do it going forward.

LibraryIndex

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

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.
use_deprecated_yui()

A convenience method for modifying the standard LibraryIndex to switch on the deprecated yuigridscss Library.

enable_experimental_bootstrap()

A convenience method for modifying the standard LibraryIndex to switch on experimental Bootstrap Library and its dependencies.

Library

class reahl.web.libraries.Library(name)

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 = None

The unique name of this Library

egg_name = None

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

shipped_in_directory = None

The directory that contains the files of this library (relative to the egg root)

files = None

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

Reahl

class reahl.web.libraries.Reahl

JavaScript and CSS that is part of Reahl itself.

JQuery

class reahl.web.libraries.JQuery

Version 1.11.2 of JQuery.

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

Plugin Version
jquery-migrate 1.2.1
jquery.cookie 1.0
jquery.metadata 2.1
jquery.validate 1.10.0 (a heavily modified version)
jquery.ba-bbq 1.2.1
jquery.blockUI 2.70.0
jquery.form 3.14

Pure

class reahl.web.libraries.Pure

Version 0.5.0 of Pure UI.

Warning

This Library will be removed in future versions as part of our intended move to Bootstrap.

Bootstrap4

class reahl.web.libraries.Bootstrap4

Version 4.0.0 alpha 2 of Bootstrap.

ReahlBootstrap4Additions

class reahl.web.libraries.ReahlBootstrap4Additions

Reahl specific JavaScript and CSS for use with Bootstrap4.

HTML5Shiv

class reahl.web.libraries.HTML5Shiv

Version 3.6.3 of html5shiv.

IE9

class reahl.web.libraries.IE9

Version 2.1(beta4) of IE9.js.

Holder

class reahl.web.libraries.Holder

Version 2.9.0 of Holder.

Tether

class reahl.web.libraries.Tether

Version 1.1.1 of Tether.

JQueryUI

class reahl.web.libraries.JQueryUI

A heavily customised subset of version 1.10.3 of JQuery UI.

Warning

This Library will be trimmed in future to only contain the Widget Factory.

YuiGridsCss

class reahl.web.libraries.YuiGridsCss

A customised version of Yui Grids CSS.

Deprecated since version 3.1.

Warning

This Library is not enabled by default. It is currently still here to provide backwards compatibility. Note that it will be removed in future versions as part of our intended move to Bootstrap.