Skip to content

Commit 705a6bd

Browse files
committed
document jQuery config option, assign ids for each config value in the docs so they can be referenced in URLs.
1 parent 2667a40 commit 705a6bd

2 files changed

Lines changed: 22 additions & 27 deletions

File tree

docs/api.html

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -548,38 +548,42 @@ <h2>
548548

549549
<p>Supported configuration options:</p>
550550

551-
<p><strong>baseUrl</strong>: the root path to use for all module lookups. So in the above example, "my/module"'s script tag will have a src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fanother%2Fpath%2Fmy%2Fmodule.js". baseUrl is <strong>not</strong> used when loading plain .js files, those strings are used as-is, so a.js and b.js will be loaded from the same directory as the HTML page that contains the above snippet.</p>
551+
<p id="config-baseUrl"><strong>baseUrl</strong>: the root path to use for all module lookups. So in the above example, "my/module"'s script tag will have a src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fanother%2Fpath%2Fmy%2Fmodule.js". baseUrl is <strong>not</strong> used when loading plain .js files, those strings are used as-is, so a.js and b.js will be loaded from the same directory as the HTML page that contains the above snippet.</p>
552552

553553
<p>If no baseUrl is explicitly set in the configuration, the default value will be the location of the HTML page that loads require.js. If a <strong>data-main</strong> attribute is used, that path will become the baseUrl.</p>
554554

555555
<p>The baseUrl can be a URL on a different domain as the page that will load require.js. RequireJS script loading works across domains. The only restriction is on text content loaded by text! plugins: those paths should be on the same domain as the page, at least during development. The optimization tool will inline text! plugin resources so after using the optimization tool, you can use resources that reference text! plugin resources from another domain.</p>
556556

557-
<p><strong>paths</strong>: path mappings for module names not found directly under baseUrl. The path settings are assumed to be relative to baseUrl, unless the paths setting starts with a "/" or has a URL protocol in it ("like http:"). In those cases, the path is determined relative to baseUrl. Using the above sample config, "some/module"'s script tag will be src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fanother%2Fpath%2Fsome%2Fv1.0%2Fmodule.js". The path that is used for a module name should <strong>not</strong> include the .js extension, since the path mapping could be for a directory. The path mapping code will automatically add the .js extension when mapping the module name to a path.</p>
557+
<p id="config-paths"><strong>paths</strong>: path mappings for module names not found directly under baseUrl. The path settings are assumed to be relative to baseUrl, unless the paths setting starts with a "/" or has a URL protocol in it ("like http:"). In those cases, the path is determined relative to baseUrl. Using the above sample config, "some/module"'s script tag will be src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fanother%2Fpath%2Fsome%2Fv1.0%2Fmodule.js". The path that is used for a module name should <strong>not</strong> include the .js extension, since the path mapping could be for a directory. The path mapping code will automatically add the .js extension when mapping the module name to a path.</p>
558558

559-
<p><strong>packagePaths</strong>: configures module name prefixes to map to CommonJS packages. See the <a href="#packages">packages topic</a> for more information. Related to <strong>packages</strong> config option.</p>
559+
<p id="config-packagePaths"><strong>packagePaths</strong>: configures module name prefixes to map to CommonJS packages. See the <a href="#packages">packages topic</a> for more information. Related to <strong>packages</strong> config option.</p>
560560

561-
<p><strong>packages</strong>: configures loading modules from CommonJS packages. See the <a href="#packages">packages topic</a> for more information. Related to <strong>packagePaths</strong> config option.</p>
561+
<p id="config-packages"><strong>packages</strong>: configures loading modules from CommonJS packages. See the <a href="#packages">packages topic</a> for more information. Related to <strong>packagePaths</strong> config option.</p>
562562

563-
<p><strong>waitSeconds</strong>: The number of seconds to wait before giving up on loading a script. The default is 7 seconds.</p>
563+
<p id="config-waitSeconds"><strong>waitSeconds</strong>: The number of seconds to wait before giving up on loading a script. The default is 7 seconds.</p>
564564

565-
<p><strong>locale</strong>: The locale to use for loading i18n bundles. By default navigator.language or navigator.userLanguage will be used. The proper syntax for specifying a locale is using lowercase and separating values by dashes, for instance: "fr-fr-paris" or "en-us".</p>
565+
<p id="config-locale"><strong>locale</strong>: The locale to use for loading i18n bundles. By default navigator.language or navigator.userLanguage will be used. The proper syntax for specifying a locale is using lowercase and separating values by dashes, for instance: "fr-fr-paris" or "en-us".</p>
566566

567-
<p><strong>context</strong>: A name to give to a loading context. This allows require.js to load multiple versions of modules in a page, as long as each top-level require call specifies a unique context string. See <strong>Advanced Features</strong> below.</p>
567+
<p id="config-context"><strong>context</strong>: A name to give to a loading context. This allows require.js to load multiple versions of modules in a page, as long as each top-level require call specifies a unique context string. See <strong>Advanced Features</strong> below.</p>
568568

569-
<p><strong>deps</strong>: An array of dependencies to load. Useful when require is defined as a config object before require.js is loaded, and you want to specify dependencies to load as soon as require() is defined.</p>
569+
<p id="config-deps"><strong>deps</strong>: An array of dependencies to load. Useful when require is defined as a config object before require.js is loaded, and you want to specify dependencies to load as soon as require() is defined.</p>
570570

571-
<p><strong>callback</strong>: A function to pass to require that should be require after <strong>deps</strong> have been loaded. Useful when require is defined as a config object before require.js is loaded, and you want to specify a function to require after the configuration's <strong>deps</strong> array has been loaded.</p>
571+
<p id="config-callback"><strong>callback</strong>: A function to pass to require that should be require after <strong>deps</strong> have been loaded. Useful when require is defined as a config object before require.js is loaded, and you want to specify a function to require after the configuration's <strong>deps</strong> array has been loaded.</p>
572572

573-
<p><strong>ready</strong>: A function to pass to require.ready(). Useful when require is defined as a config object before require.js is loaded, and you want to specify a require.ready callback to set as soon as require() is defined.</p>
573+
<p id="config-ready"><strong>ready</strong>: A function to pass to require.ready(). Useful when require is defined as a config object before require.js is loaded, and you want to specify a require.ready callback to set as soon as require() is defined.</p>
574574

575-
<p><strong>priority</strong>: An array of module/file names to load immediately, before tracing down any other dependencies. This allows you to set up a small set of files that are downloaded in parallel that contain most of the modules and their dependencies already built in. More information is in the <a href="faq-optimization#priority">Optimization FAQ, Priority Downloads</a>.<b>Note:</b> resources loaded by loader plugins (like 'text!template.html') <b>cannot</b> be specified in the priority array: the priority mechanism only works with regular JavaScript resources.</p>
575+
<p id="config-priority"><strong>priority</strong>: An array of module/file names to load immediately, before tracing down any other dependencies. This allows you to set up a small set of files that are downloaded in parallel that contain most of the modules and their dependencies already built in. More information is in the <a href="faq-optimization#priority">Optimization FAQ, Priority Downloads</a>.<b>Note:</b> resources loaded by loader plugins (like 'text!template.html') <b>cannot</b> be specified in the priority array: the priority mechanism only works with regular JavaScript resources.</p>
576576

577-
<p><strong>urlArgs</strong>: Extra query string arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. Example cache bust setting for urlArgs:</p>
577+
<p id="config-urlArgs"><strong>urlArgs</strong>: Extra query string arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. Example cache bust setting for urlArgs:</p>
578578

579579
<pre><code>urlArgs: "bust=" + (new Date()).getTime()
580580
</code></pre>
581581

582582
<p>During development it can be useful to use this, however <strong>be sure</strong> to remove it before deploying your code.</p>
583+
584+
<p id="config-jQuery"><strong>jQuery</strong>: (RequireJS 0.25.0+) specify an exact version match for the version of jQuery that should be allowed to register as the 'jquery' dependency. This is useful in environments where multiple jQuery files could be loaded but you want
585+
to be sure to get the right version of jQuery for your loading context. Normally you do not need to set this if you are only loading one version of jQuery in a page. However, if you use third party libraries that may also load jQuery, it is best to set this option.</p>
586+
583587
</div>
584588

585589
<div class="section">

tasks.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Next release
1010

1111
- implement require('.')
1212

13+
- Put in error message with URL refs to faq page?
14+
- one candidate: mismatched require.def calls: happens when loading some modules/scripts with inline script tags that include a named module,
15+
but later the anonymous version is loaded: so the named one is in a built file.
16+
1317
- text plugins after a build load xdomain?
1418
- Why can't plugins have dependencies? It is because the dependency is not fully evaluated.
1519
Maybe rethink it, there have been some cases where creating a plugin that uses the
@@ -25,30 +29,17 @@ Next release
2529
- Just an error in the define function causing infinite looping? Happened in firefox embedding.
2630
- Document in README the directory structure.
2731
- Support jQuery holdReady
28-
- Document config.jQuery support
29-
- https://github.com/jrburke/requirejs/issues/96
32+
- run css optimizer before JS optimizer: https://github.com/jrburke/requirejs/issues/96
3033
- Pointer to motivations behind current thing, reason for dependencies.
3134

32-
- Need an AMD test suite
33-
3435
- "libs/static.lib.02", //kaaahhhhnnnn!!!
35-
- optimizer as a separate project?
36-
- Build the optimizer as its own project, at least enough to take out the
37-
work from jquery-require-sample
3836
- https://github.com/jrburke/requirejs/pull/71: process by 2/21
3937

4038
- build tool to rename require and define calls to other names?
4139
- Confirm: From Richard Backhouse: As an FYI I have been doing my own investigation of using UglifyJS for compression
4240
and one thing I found when trying to compress dojo 1.5 code was that I had ensure that "make_seqs"
4341
flag was set to false when calling ast_squeeze. If I left this flag set to true the code would not load.
44-
- Put in error message with URL refs to faq page?
45-
- one candidate: mismatched require.def calls: happens when loading some modules/scripts with inline script tags that include a named module,
46-
but later the anonymous version is loaded: so the named one is in a built file.
47-
- Point to Miller's gist for ant integration: https://gist.github.com/825117
48-
- Build with requireplugins-jquery.js uses bad definition for require/text, probably other plugins. Use a jqueryStub.js
49-
for builds that need it with plain define, and allow the build system to load
50-
the plugins. A problem, since previously built layers with plugins in them
51-
can cause a problem.
42+
5243

5344
Bugs to work on
5445
------------------

0 commit comments

Comments
 (0)