Skip to content

Commit

Permalink
tutorial update
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Apr 7, 2015
1 parent 5c69376 commit ac99e3d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Setup Require.js Application
----------------------------

Start by creating and configuring the require.js application. If your
application is already up and running, you can move on to the
application is already up and running, you can skip to the
:ref:`Django configuration <django-config>` section.

Structure
^^^^^^^^^

For example, in a Django_ project called ``myproject`` there is a
For this example, in a Django_ project called ``myproject``, there is a
require.js application called ``app`` with a directory structure
similar to this::

Expand All @@ -35,8 +35,8 @@ similar to this::
- JS-LICENSE.txt


Application
^^^^^^^^^^^
Main Application
^^^^^^^^^^^^^^^^

The main require.js application in ``static/js/app/main.js`` contains:

Expand Down Expand Up @@ -155,6 +155,8 @@ for details):

.. code-block:: python
import os
# The baseUrl to pass to the r.js optimizer.
REQUIRE_BASE_URL = 'js'
Expand All @@ -181,10 +183,12 @@ for details):
}
# A tuple of files to exclude from the compilation result of r.js.
REQUIRE_EXCLUDE = ('build.txt',
REQUIRE_EXCLUDE = (
'build.txt',
os.path.join(REQUIRE_BASE_URL, REQUIRE_BUILD_PROFILE),
)
Configure Header
^^^^^^^^^^^^^^^^

Expand All @@ -194,6 +198,8 @@ and a dict containing the variables that we inject into the license header.

.. code-block:: python
from datetime import datetime, date
# A dictionary of output files with a license header config.
REQUIRE_LICENSE_HEADERS = {
os.path.join(REQUIRE_BASE_URL, 'app.min.js'): {
Expand All @@ -202,17 +208,16 @@ and a dict containing the variables that we inject into the license header.
'copyright_year': datetime.now().year,
'copyright_holder': 'MyCompany',
'license_url': 'http://example.com/license',
'version': '1.0.1'
'version': 'myproject.version'
}
}
The only mandatory key is ``license_file``: the path to the license header
template file, eg. ``js/JS-LICENSE.txt``.

The ``version`` key (optional) is special: use a string value here,
eg. ``1.0.4``, or specify a fully-qualified path to an
attribute that contains a string version instead,
eg. ``myproject.version``.
The ``version`` key is special: use a string value here, eg. ``1.0.4``, or
specify a fully-qualified path to an attribute that contains a string version
instead, eg. ``myproject.version``.

Any other keys found in the dict will also be injected in the license header
template.
Expand Down

0 comments on commit ac99e3d

Please sign in to comment.