Example sources in the examples dir

This commit is contained in:
Tim Schaub
2015-04-14 10:27:32 -06:00
parent 8fd2e9f79f
commit 89f5e711e6
309 changed files with 21 additions and 16 deletions

View File

@@ -112,17 +112,17 @@ EXECUTABLES = [variables.CLEANCSS, variables.GIT, variables.GJSLINT,
variables.JSDOC, variables.JSHINT, variables.PYTHON,
variables.PHANTOMJS]
EXAMPLES_SRC_ALL = [path for path in ifind('examples_src')]
EXAMPLES_SRC_ALL = [path for path in ifind('examples')]
EXAMPLES_SRC_HTML = [path
for path in EXAMPLES_SRC_ALL
if path.endswith('.html')
if path != 'examples_src/index.html']
if path != 'examples/index.html']
EXAMPLES_SRC_JS = [example.replace('.html', '.js')
for example in EXAMPLES_SRC_HTML]
EXAMPLES_DEST_ALL = [path.replace('examples_src', 'build/examples')
EXAMPLES_DEST_ALL = [path.replace('examples', 'build/examples')
for path in EXAMPLES_SRC_ALL]
GLSL_SRC = [path
@@ -259,7 +259,7 @@ virtual('examples', EXAMPLES_DEST_ALL)
def examples_dest(name, match):
def action(t):
t.run('node', 'tasks/build-examples.js')
dependencies = ['examples_src/%(filepath)s' % match.groupdict()]
dependencies = ['examples/%(filepath)s' % match.groupdict()]
return Target(name, action=action, dependencies=dependencies)
@@ -701,7 +701,7 @@ def host_examples(t):
@target('check-examples', 'host-examples', phony=True)
def check_examples(t):
examples = ['build/hosted/%(BRANCH)s/' + e.replace('examples_src', 'examples')
examples = ['build/hosted/%(BRANCH)s/' + e
for e in EXAMPLES_SRC_HTML
if not open(e.replace('.html', '.js'), 'rU').readline().startswith('// NOCOMPILE')]
all_examples = [e + '?mode=advanced' for e in examples]

View File

@@ -1,16 +1,21 @@
This folder contains example templates. These templates are used to build the examples in `examples_src/` folder. The resulting examples are written to the `examples/` folder.
This folder contains example templates. These templates are used to build the examples in the `examples/` folder. The resulting examples are written to the `build/examples` folder.
Although the main purpose of these examples is to demonstrate how to use the API, they also serve other purposes in the development cycle, and so are not exactly as they would be in normal application code:
* every time the library changes, they are compiled together with the library as a basic check that they remain in sync with the library
* they use a special loader script to enable defining at run time which build mode (raw/debug/advanced) to use
* every time the library changes, they are compiled together with the library as a basic check that they remain in sync with the library
* they use a special loader script to enable defining at run time which build mode (raw/debug/advanced) to use
To enable this, examples have the following, not needed in application code:
* each html file loads `loader.js`; application code would not need this, but would instead load the appropriate library build file, either a hosted version or a custom build
* each js file starts with `goog.require` functions, used by the compiler; application code would only have these if the code is to be compiled together with the library and/or Closure library
* some js files use type definitions (comments with @type tags); these are also used by the compiler, and are only needed if the code is to be compiled together with the library
* html files load `example-behaviour.js` and some js files define the Map renderer option as `exampleNS.getRendererFromQueryString()`; application code would not need these
* in addition, examples use Twitter Bootstrap and jQuery; this is of course not a requirement - you may use whichever presentation/helper libraries you wish
* each html file loads `loader.js`; application code would not need this, but would instead load the appropriate library build file, either a hosted version or a custom build
At the bottom of each example generated in the `examples/` folder, a modified version of its source code is shown. That modified version can be run standalone and is usually used as starting point for users to extend examples into their own application.
* each js file starts with `goog.require` functions, used by the compiler; application code would only have these if the code is to be compiled together with the library and/or Closure library
* some js files use type definitions (comments with @type tags); these are also used by the compiler, and are only needed if the code is to be compiled together with the library
* html files load `example-behaviour.js` and some js files define the Map renderer option as `exampleNS.getRendererFromQueryString()`; application code would not need these
* in addition, examples use Twitter Bootstrap and jQuery; this is of course not a requirement - you may use whichever presentation/helper libraries you wish
At the bottom of each example generated in the `build/examples` folder, a modified version of its source code is shown. That modified version can be run standalone and is usually used as starting point for users to extend examples into their own application.

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 398 B

View File

Before

Width:  |  Height:  |  Size: 829 B

After

Width:  |  Height:  |  Size: 829 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Some files were not shown because too many files have changed in this diff Show More