@@ -8,13 +8,13 @@ Setup Require.js Application
88----------------------------
99
1010Start by creating and configuring the require.js application. If your
11- application is already up and running, you can move on to the
11+ application is already up and running, you can skip to the
1212:ref: `Django configuration <django-config >` section.
1313
1414Structure
1515^^^^^^^^^
1616
17- For example, in a Django _ project called ``myproject `` there is a
17+ For this example, in a Django _ project called ``myproject ``, there is a
1818require.js application called ``app `` with a directory structure
1919similar to this::
2020
@@ -35,8 +35,8 @@ similar to this::
3535 - JS-LICENSE.txt
3636
3737
38- Application
39- ^^^^^^^^^^^
38+ Main Application
39+ ^^^^^^^^^^^^^^^^
4040
4141The main require.js application in ``static/js/app/main.js `` contains:
4242
@@ -155,6 +155,8 @@ for details):
155155
156156.. code-block :: python
157157
158+ import os
159+
158160 # The baseUrl to pass to the r.js optimizer.
159161 REQUIRE_BASE_URL = ' js'
160162
@@ -181,10 +183,12 @@ for details):
181183 }
182184
183185 # A tuple of files to exclude from the compilation result of r.js.
184- REQUIRE_EXCLUDE = (' build.txt' ,
186+ REQUIRE_EXCLUDE = (
187+ ' build.txt' ,
185188 os.path.join(REQUIRE_BASE_URL , REQUIRE_BUILD_PROFILE ),
186189 )
187190
191+
188192 Configure Header
189193^^^^^^^^^^^^^^^^
190194
@@ -194,6 +198,8 @@ and a dict containing the variables that we inject into the license header.
194198
195199.. code-block :: python
196200
201+ from datetime import datetime, date
202+
197203 # A dictionary of output files with a license header config.
198204 REQUIRE_LICENSE_HEADERS = {
199205 os.path.join(REQUIRE_BASE_URL , ' app.min.js' ): {
@@ -202,17 +208,16 @@ and a dict containing the variables that we inject into the license header.
202208 ' copyright_year' : datetime.now().year,
203209 ' copyright_holder' : ' MyCompany' ,
204210 ' license_url' : ' http://example.com/license' ,
205- ' version' : ' 1.0.1 '
211+ ' version' : ' myproject.version '
206212 }
207213 }
208214
209215 The only mandatory key is ``license_file ``: the path to the license header
210216template file, eg. ``js/JS-LICENSE.txt ``.
211217
212- The ``version `` key (optional) is special: use a string value here,
213- eg. ``1.0.4 ``, or specify a fully-qualified path to an
214- attribute that contains a string version instead,
215- eg. ``myproject.version ``.
218+ The ``version `` key is special: use a string value here, eg. ``1.0.4 ``, or
219+ specify a fully-qualified path to an attribute that contains a string version
220+ instead, eg. ``myproject.version ``.
216221
217222Any other keys found in the dict will also be injected in the license header
218223template.
0 commit comments