11Handling of External Javascript and CSS Components
22==================================================
33
4- This directory (``static/ ``) holds a number of subdirectories, where one is handled
5- differently than the rest: the ``lib/ `` subdirectory holds distribution files for external
6- client-side components, currently (18 Apr 2015) this means ``js `` and ``css `` components.
4+ This directory (``static/ ``) holds a number of subdirectories, where one is
5+ handled differently than the rest: the ``lib/ `` subdirectory holds
6+ distribution files for external client-side components, currently (28 Jul
7+ 2015) this means ``js `` and ``css `` components and fonts.
78
8- These components each reside in their own subdirectory, which is named with the component
9- name:
9+ These components each reside in their own subdirectory, which is named with
10+ the component name:
1011
1112 henrik@zinfandel $ ls -l static/lib
12- total 44
13+ total 52
14+ drwxr-xr-x 5 henrik henrik 4096 Jul 26 08:55 admin
1315 drwxr-xr-x 6 henrik henrik 4096 Jul 25 15:25 bootstrap
1416 drwxr-xr-x 4 henrik henrik 4096 Jul 25 15:25 bootstrap-datepicker
17+ drwxr-xr-x 5 henrik henrik 4096 Jul 28 02:39 custom-bootstrap
1518 drwxr-xr-x 4 henrik henrik 4096 Jul 25 15:25 font-awesome
1619 drwxr-xr-x 2 henrik henrik 4096 Jul 25 15:25 jquery
1720 drwxr-xr-x 2 henrik henrik 4096 Jul 25 15:25 jquery.cookie
@@ -20,38 +23,42 @@ name:
2023 drwxr-xr-x 2 henrik henrik 4096 Jul 25 15:24 ptserif
2124 drwxr-xr-x 2 henrik henrik 4096 Jul 25 15:25 select2
2225 drwxr-xr-x 2 henrik henrik 4096 Jul 25 15:25 select2-bootstrap-css
26+ drwxrwxrwx 3 henrik henrik 4096 Jul 27 11:42 static
2327
24- If resources served over a CDN and/or with a high max-age don't have different URLs for
25- different versions, then any component upgrade which is accompanied by a change in template
26- functionality will be have a long transition time during which the new pages are served with
27- old components, with possible breakage. We want to avoid this.
28+ If resources served over a CDN and/or with a high max-age don't have different
29+ URLs for different versions, then any component upgrade which is accompanied
30+ by a change in template functionality will be have a long transition time
31+ during which the new pages are served with old components, with possible
32+ breakage. We want to avoid this.
2833
29- The intention is that after a release has been checked out, but before it is deployed,
30- the whole static directory should be copied to a location which is accessible under the
31- URL given by STATIC_URL -- in production mode this URL contains the datatracker release
32- version, which will let the CDN serve the static files which correspond to the current
33- release.
34+ The intention is that after a release has been checked out, but before it is
35+ deployed, the whole static directory should be symlinked or copied to a
36+ location which is accessible under the URL given by STATIC_URL -- in
37+ production mode this URL contains the datatracker release version, which will
38+ let the CDN serve the static files which correspond to the current release.
3439
35- With the exception of the ``pt* `` fonts, all components under `` static/lib/ `` are managed
36- through a bower _ file; `` ietf/ static/bower.json ``. In order to install a new
37- version of a component, you should update the `` bower.json `` file, and then run the management
38- command::
40+ With the exception of the ``pt* `` fonts and `` custom-bootstrap ``, the
41+ components under `` static/lib/ `` are managed through a bower _ file;
42+ `` ietf/ bower.json ``. In order to install a new version of a component, you
43+ should update the `` bower.json `` file, and then run the management command::
3944
4045 $ ietf/manage.py bower_install
4146
42- That command will fetch the required version of each external component listed in
43- ``bower.json `` (actually, it will do this for *all * ``bower.json `` files found in the
44- ``static/ `` directories of all ``INSTALLED_APPS ``), saving them temporarily under
45- ``.tmp/bower_components/ ``; it will then extract the relevant ``js `` and ``css `` files and
46- place them in an appropriately named directory under ``static/lib/ ``. The location
47- used by ``bower_install `` is is controlled by ``COMPONENT_ROOT `` in ``settings.py ``.
48-
49- Any datatracker-specific static files which should be served by the CDN rather than
50- directly by the datatracker web server should be moved from under ``static/ to ``ietf/static/ ``,
51- so that they will be collected by the ``ietf/manage.py collectstatic `` command and
52- placed under `static/lib/`` from where they will be made available to the CDN. Any
53- template files referencing the files in question will need to be updated to use the
54- ``{% static 'foo/bar.jpg' %} `` notation to reference the files, so that the correct
55- static url will be emitted.
47+ That command will fetch the required version of each external component listed
48+ in ``bower.json `` (actually, it will do this for *all * ``bower.json `` files
49+ found in all ``INSTALLED_APPS `` directories), saving them temporarily under
50+ ``.tmp/bower_components/ ``; it will then extract the relevant ``js `` and
51+ ``css `` files and place them in an appropriately named directory under
52+ ``static/lib/ ``. The location used by ``bower_install `` is controlled by the
53+ ``COMPONENT_ROOT `` setting in ``settings.py ``.
54+
55+ Any datatracker-specific static files which should be served by the CDN rather
56+ than directly by the datatracker web server should be moved from under
57+ ``static/ `` to ``ietf/static/ ``, so that they will be collected by the
58+ ``ietf/manage.py collectstatic `` command and placed under `static/lib/`` from
59+ where they will be made available to the CDN. Any template files referencing
60+ the files in question will need to be updated to use the ``{% static
61+ 'foo/bar.jpg' %} `` notation to reference the files, so that the correct static
62+ url will be emitted both in production and development mode.
5663
5764.. _bower : http://bower.io/
0 commit comments