[openstack-dev] [horizon] xstatic for removing bundled js libs

Radomir Dopieralski openstack at sheep.art.pl
Wed Mar 26 08:25:26 UTC 2014


Hello,

Before we split Horizon into two parts, we need to deal with a couple of
related cleanup tasks. One of them is getting rid of the bundled
JavaScript libraries that we are using. They are currently just included
in the Horizon's source tree. Ideally, we would like to have them
installed as dependencies. There is a blueprint for that at:

https://blueprints.launchpad.net/horizon/+spec/remove-javascript-bundling

We have several options for actually doing this. One of them is
selecting an appropriate django-* library, where available, and using
whatever additional API and code the author of the library made
available. We need to choose carefully, and every library has to be
approached separately for this.

I propose a more general solution of using xstatic-* Python packages,
which contain basically just the files that we want to bundle, plus some
small amount of metadata. All of the JavaScript (and any static files,
really, including styles, fonts and icons) would be then handled the
same way, by just adding the relevant package to the requirements and to
the settings.py file. Packaging the libraries that are missing is very
easy (as there is no extra code to write), and we get to share the
effort with other projects that use xstatic.

Anyways, I made a proof of concept patch that demonstrates this approach
for the jQuery library. Obviously it fails Jenkins tests, as the xstatic
and xstatic-jquery packages are not included in the global requirements,
but it shows how little effort is involved. You can see the patch at:

https://review.openstack.org/#/c/82516/

Any feedback and suggestions appreciated.
-- 
Radomir Dopieralski



More information about the OpenStack-dev mailing list