Skip to content

Commit 8b99b67

Browse files
author
Lauren McCarthy
committed
fixes #1129
1 parent c2aa5ba commit 8b99b67

File tree

4 files changed

+65
-37
lines changed

4 files changed

+65
-37
lines changed

Gruntfile.js

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55
*
66
* There are three main tasks:
77
*
8-
* grunt - This is the default task, which builds the code, tests it
9-
* using both jslint and mocha, and then minifies it.
8+
* grunt - This is the default task, which builds the code, tests it
9+
* using both jslint and mocha, and then minifies it.
1010
*
11-
* grunt yui - This will build the inline documentation for p5.js.
11+
* grunt yui - This will build the inline documentation for p5.js.
1212
*
13-
* grunt test - This rebuilds the source and runs the automated tests on
14-
* both the minified and unminified code. If you need to debug
15-
* a test suite in a browser, `grunt test --keepalive` will
16-
* start the connect server and leave it running; the tests
17-
* can then be opened at localhost:9001/test/test.html
13+
* grunt yui_dev - This will build the inline documentation but linking to
14+
* remote JS/CSS and assets so pages look correct in local
15+
* testing. "grunt yui" should be run to build docs ready
16+
* for production.
17+
*
18+
* grunt test - This rebuilds the source and runs the automated tests on
19+
* both the minified and unminified code. If you need to debug
20+
* a test suite in a browser, `grunt test --keepalive` will
21+
* start the connect server and leave it running; the tests
22+
* can then be opened at localhost:9001/test/test.html
1823
*
1924
* Note: `grunt test:nobuild` will skip the build step when running the tests,
2025
* and only runs the test files themselves through the linter: this can save
@@ -218,7 +223,25 @@ module.exports = function(grunt) {
218223

219224
// this builds the documentation for the codebase.
220225
yuidoc: {
221-
compile: {
226+
prod: {
227+
name: '<%= pkg.name %>',
228+
description: '<%= pkg.description %>',
229+
version: '<%= pkg.version %>',
230+
url: '<%= pkg.homepage %>',
231+
options: {
232+
paths: ['src/', 'lib/addons/'],
233+
themedir: 'docs/yuidoc-p5-theme/',
234+
235+
// These helpers define URL paths to p5js.org resources
236+
// based on the value of the P5_SITE_ROOT environment variable.
237+
// Set it to '..' for production and leave it blank or
238+
// undefined for development.
239+
helpers: ['docs/yuidoc-p5-theme/helpers/helpers_prod.js'],
240+
241+
outdir: 'docs/reference/'
242+
}
243+
},
244+
dev: {
222245
name: '<%= pkg.name %>',
223246
description: '<%= pkg.description %>',
224247
version: '<%= pkg.version %>',
@@ -231,7 +254,7 @@ module.exports = function(grunt) {
231254
// based on the value of the P5_SITE_ROOT environment variable.
232255
// Set it to '..' for production and leave it blank or
233256
// undefined for development.
234-
helpers: ['docs/yuidoc-p5-theme/helpers/helpers.js'],
257+
helpers: ['docs/yuidoc-p5-theme/helpers/helpers_dev.js'],
235258

236259
outdir: 'docs/reference/'
237260
}
@@ -316,7 +339,8 @@ module.exports = function(grunt) {
316339
grunt.registerTask('build', ['browserify', 'uglify', 'requirejs']);
317340
grunt.registerTask('test', ['jshint', 'jscs', 'build', 'connect', 'mocha']);
318341
grunt.registerTask('test:nobuild', ['jshint:test', 'jscs:test', 'connect', 'mocha']);
319-
grunt.registerTask('yui', ['yuidoc']);
342+
grunt.registerTask('yui', ['yuidoc:prod']);
343+
grunt.registerTask('yui:dev', ['yuidoc:dev']);
320344
grunt.registerTask('default', ['test']);
321345
grunt.registerTask('saucetest', ['connect', 'saucelabs-mocha']);
322346
};

docs/yuidoc-p5-theme/helpers/helpers.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var configHelpers = {};
2+
var config = {
3+
p5SiteRoot: 'http://p5js.org',
4+
p5Lib: '/lib/p5.js',
5+
p5SoundLib: '/lib/addons/p5.sound.js',
6+
p5DomLib: '/lib/addons/p5.dom.js'
7+
};
8+
9+
Object.keys(config).forEach(function(key) {
10+
configHelpers[key] = function() {
11+
return config[key];
12+
};
13+
});
14+
15+
module.exports = configHelpers;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var configHelpers = {};
2+
var config = {
3+
p5SiteRoot: 'http://p5js.org',
4+
p5Lib: 'http://p5js.org/js/p5.min.js',
5+
p5SoundLib: 'http://p5js.org/js/p5.sound.js',
6+
p5DomLib: 'http://p5js.org/js/p5.dom.js'
7+
};
8+
9+
Object.keys(config).forEach(function(key) {
10+
configHelpers[key] = function() {
11+
return config[key];
12+
};
13+
});
14+
15+
module.exports = configHelpers;

0 commit comments

Comments
 (0)