Skip to content
Wolfgang Thomas edited this page Sep 30, 2016 · 6 revisions

plone.patternslib concepts

---- under development ----

Idea

plone.patternslib is meant to be a drop in component which provides a pre-compiled version of patternslib (http://patternslib.com) for use in Plone.

Plone 5 already uses a similar js framework called mockup (which is derived from patternslib), so there is some overlap and conflict when installing both in parallel. plone.patternslib is meant to avoid these conflicts and wants to provide only additional patterns which are not present in Plone already.

How to use plone.patternslib?

  • Add plone.patternslib to your egg section in buildout
  • Install Plone Patternslib into your site, via Site Setup -> Add-ons
  • Start plone and access /Plone/@@pat-switch. If you can click the buttons and the colour changes, then the installation has worked.
  • Look at the examples to get an idea of the available patterns

How to develop plone.patternslib?

The plone.patternslib package contains

  • a compiled bundle of patterns (static/patterns-compiled.js) which runs in Plone 5
  • the necessary registration to make it show up in the resource registry
  • Browser views that demo the current functionality
  • Configuration files necessary to download and compile a new bundle of patterns.

Create a new bundle

You need to have the Node package manager installed in your system for this to work. The Node package manager is a tool to download and manage javascript dependencies. We use it to build the patterns bundle. Download and install the latest version from http://nodejs.org.

Creating a new bundle means doing the following steps:

  • Running npm to fetch bower (see package.json)
  • Running bower to fetch all dependencies (see bower.json)
  • Running the requirejs bundler to combine all dependencies to one single file (see build.js, main.js and src/patterns.js)

To make it easier, all necessary commands are available in a Makefile, located in src/plone/patternslib/static. You can do the following commands:

  • make bundle or just make Runs npm, bower and requirejs, outputs a bundle.js

  • make clean removes all downloaded dependencies and caches.

Releasing a bundle

Releasing a bundle means:

  • committing it into the plone.patternslib repository and then
  • releasing plone.patternslib as an egg.

The javascript dependencies of a bundle are not checked in.

Once you have created your new bundle using make bundle, you can test it and commit it if you are happy.