automated style formatting on save of all js files and updated gulp build

This commit is contained in:
Doug Fritz 2014-09-14 19:48:00 -07:00
parent 1f05d74eb2
commit 4f0222f812
23 changed files with 524 additions and 490 deletions

View File

@ -1,4 +1,4 @@
[*.js] [*]
indent_style = space indent_style = space
indent_size = 4 indent_size = 4

44
.jscsrc
View File

@ -1,44 +0,0 @@
{
"fileExtensions": [".js", ".json"],
"excludeFiles": ["node_modules/**", "build/**"],
"maximumLineLength": 120,
"validateLineBreaks": "LF",
"validateIndentation": 4,
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInsideParentheses": "all",
"requireSpacesInsideObjectBrackets": "all",
"requireSpacesInsideArrayBrackets": "all",
"requireParenthesesAroundIIFE": true,
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowKeywords": ["with"],
"disallowImplicitTypeConversion": ["string"]
}

View File

@ -2,6 +2,7 @@ BUILD
- [x] single import - [x] single import
- [x] browsersync - [x] browsersync
- [ ] remove platform, dependent on fix of bug in gulp-vulcanize
REFACTOR REFACTOR
@ -9,6 +10,7 @@ REFACTOR
- [ ] Gui.js => gui-panel => dat-gui - [ ] Gui.js => gui-panel => dat-gui
- [x] controller-* => dat-gui-* - [x] controller-* => dat-gui-*
- [x] kill strict - [x] kill strict
- [x] Reorg gulpfile and add standardized formatting
PARITY PARITY

View File

@ -20,5 +20,10 @@
"dependencies": { "dependencies": {
"polymer": "Polymer/polymer#>=0.4.0", "polymer": "Polymer/polymer#>=0.4.0",
"platform": "Polymer/platform#>=0.4.0" "platform": "Polymer/platform#>=0.4.0"
},
"resolutions": {
"core-action-icons": "0.2.4",
"platform": ">=0.4.0 <1.0.0",
"core-component-page": ">=0.4.0 <1.0.0"
} }
} }

12
build/dat-gui.html Normal file → Executable file

File diff suppressed because one or more lines are too long

14
build/dat-gui.js Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,6 @@ h1
margin-bottom unit * 3 margin-bottom unit * 3
h3 h3
padding unit 0 padding unit 0
margin-bottom unit * 2 margin-bottom unit * 2

View File

@ -15,7 +15,9 @@
<body> <body>
<!-- Copied from README.md --> <!-- Copied from README.md -->
<div id="readme"></div> <div id="readme">
<%= contents %>
</div>
<script src="docs/main.js"></script> <script src="docs/main.js"></script>
<script src="docs/examples.js"></script> <script src="docs/examples.js"></script>

View File

@ -1,234 +1,231 @@
( function( scope ) { ( function( scope ) {
/* globals Path */ /* globals Path */
var Gui = function( params ) { var Gui = function( params ) {
if ( !ready ) { if ( !ready ) {
Gui.error( 'Gui not ready. Put your code inside Gui.ready()' ); Gui.error( 'Gui not ready. Put your code inside Gui.ready()' );
} }
params = params || {}; params = params || {};
// Properties // Properties
this.vars = {}; this.vars = {};
this.localStorage = params.localStorage || false; this.localStorage = params.localStorage || false;
// Make domElement // Make domElement
this.panel = document.createElement( 'dat-gui' ); this.panel = document.createElement( 'dat-gui' );
this.panel.autoPlace = params.autoPlace !== false; this.panel.autoPlace = params.autoPlace !== false;
if ( this.panel.autoPlace ) { if ( this.panel.autoPlace ) {
document.body.appendChild( this.panel ); document.body.appendChild( this.panel );
} }
};
// Instance methods
// -------------------------------
Gui.prototype.add = function( object, path ) {
// Make controller
var value = Path.get( path ).getValueFrom( object );
if ( value === null || value === undefined ) {
return Gui.error( object + ' doesn\'t have a value for path "' + path + '".' );
}
var args = Array.prototype.slice.call( arguments, 2 );
var controller;
if ( args[ 0 ] instanceof Array || typeof args[ 0 ] == 'object' ) {
controller = document.createElement( 'dat-gui-option' );
} else {
controller = Gui.getController( value );
}
if ( !controller ) {
return Gui.error( 'Unrecognized type:', value );
}
controller.watch( object, path );
controller.init.apply( controller, args );
// Make row
var row = document.createElement( 'gui-row' );
row.name = path;
controller.row = row;
controller.name = function( name ) {
row.name = name;
}; };
controller.comment = function( comment ) {
// Instance methods row.comment = comment;
// -------------------------------
Gui.prototype.add = function( object, path ) {
// Make controller
var value = Path.get( path ).getValueFrom( object );
if ( value === null || value === undefined ) {
return Gui.error( object + ' doesn\'t have a value for path "' + path + '".' );
}
var args = Array.prototype.slice.call( arguments, 2 );
var controller;
if ( args[ 0 ] instanceof Array || typeof args[ 0 ] == 'object' ) {
controller = document.createElement( 'dat-gui-option' );
} else {
controller = Gui.getController( value );
}
if ( !controller ) {
return Gui.error( 'Unrecognized type:', value );
}
controller.watch( object, path );
controller.init.apply( controller, args );
// Make row
var row = document.createElement( 'gui-row' );
row.name = path;
controller.row = row;
controller.name = function( name ) {
row.name = name;
};
controller.comment = function( comment ) {
row.comment = comment;
};
row.appendChild( controller );
this.panel.appendChild( row );
return controller;
}; };
Gui.prototype.remember = function( object ) { row.appendChild( controller );
this.panel.appendChild( row );
return controller;
}; };
Gui.prototype.var = function() { Gui.prototype.remember = function( object ) {};
var name, initialValue, args; Gui.prototype.var = function() {
if ( arguments.length == 1 ) { var name, initialValue, args;
name = arguments[ 0 ];
return this.vars[ name ];
}
initialValue = arguments[ 1 ]; if ( arguments.length == 1 ) {
name = arguments[ 0 ]; name = arguments[ 0 ];
return this.vars[ name ];
}
args = [ this.vars, name ]; initialValue = arguments[ 1 ];
args = args.concat( Array.prototype.slice.call( arguments, 2 ) ); name = arguments[ 0 ];
this.vars[ name ] = initialValue; args = [ this.vars, name ];
args = args.concat( Array.prototype.slice.call( arguments, 2 ) );
return this.add.apply( this, args ); this.vars[ name ] = initialValue;
}; return this.add.apply( this, args );
Gui.prototype.listenAll = function() { };
Gui.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' ); Gui.prototype.listenAll = function() {
}; Gui.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' );
};
// Register custom controllers // Register custom controllers
// ------------------------------- // -------------------------------
var controllers = {}; var controllers = {};
Gui.register = function( elementName, test ) { Gui.register = function( elementName, test ) {
controllers[ elementName ] = test; controllers[ elementName ] = test;
}; };
// Returns a controller based on a value // Returns a controller based on a value
// ------------------------------- // -------------------------------
Gui.getController = function( value ) { Gui.getController = function( value ) {
for ( var type in controllers ) { for ( var type in controllers ) {
var test = controllers[ type ]; var test = controllers[ type ];
if ( test( value ) ) { if ( test( value ) ) {
return document.createElement( type ); return document.createElement( type );
}
} }
};
// Gui ready handler ... * shakes fist at polymer *
// -------------------------------
var ready = false;
var readyHandlers = [];
document.addEventListener( 'polymer-ready', function() {
ready = true;
readyHandlers.forEach( function( fnc ) {
fnc();
} );
} );
Gui.ready = function( fnc ) {
if ( ready ) {
fnc();
} else {
readyHandlers.push( fnc );
}
};
// Console
// -------------------------------
Gui.error = function() {
var args = Array.prototype.slice.apply( arguments );
args.unshift( 'dat-gui ::' );
console.error.apply( console, args );
};
Gui.warn = function() {
var args = Array.prototype.slice.apply( arguments );
args.unshift( 'dat-gui ::' );
console.warn.apply( console, args );
};
// Old namespaces
// -------------------------------
var dat = {};
dat.gui = {};
dat.gui.GUI = Gui;
dat.GUI = dat.gui.GUI;
dat.color = {};
dat.color.Color = function() {};
dat.dom = {};
dat.dom.dom = function() {};
dat.controllers = {};
dat.controllers.Controller = constructor( 'dat-gui-base' );
dat.controllers.NumberController = constructor( 'dat-gui-number' );
dat.controllers.FunctionController = constructor( 'dat-gui-function' );
dat.controllers.ColorController = constructor( 'dat-gui-color' );
dat.controllers.BooleanController = constructor( 'dat-gui-boolean' );
dat.controllers.OptionController = constructor( 'dat-gui-option' );
dat.controllers.NumberControllerBox = dat.controllers.NumberController;
dat.controllers.NumberControllerSlider = dat.controllers.NumberController;
function constructor( elementName ) {
return function( object, path ) {
var el = document.createElement( elementName );
el.watch( object, path );
return el;
};
} }
};
// Export
// -------------------------------
scope.dat = dat;
scope.Gui = Gui;
} )( this ); // Gui ready handler ... * shakes fist at polymer *
// -------------------------------
var ready = false;
var readyHandlers = [];
document.addEventListener( 'polymer-ready', function() {
ready = true;
readyHandlers.forEach( function( fnc ) {
fnc();
} );
} );
Gui.ready = function( fnc ) {
if ( ready ) {
fnc();
} else {
readyHandlers.push( fnc );
}
};
// Console
// -------------------------------
Gui.error = function() {
var args = Array.prototype.slice.apply( arguments );
args.unshift( 'dat-gui ::' );
console.error.apply( console, args );
};
Gui.warn = function() {
var args = Array.prototype.slice.apply( arguments );
args.unshift( 'dat-gui ::' );
console.warn.apply( console, args );
};
// Old namespaces
// -------------------------------
var dat = {};
dat.gui = {};
dat.gui.GUI = Gui;
dat.GUI = dat.gui.GUI;
dat.color = {};
dat.color.Color = function() {};
dat.dom = {};
dat.dom.dom = function() {};
dat.controllers = {};
dat.controllers.Controller = constructor( 'dat-gui-base' );
dat.controllers.NumberController = constructor( 'dat-gui-number' );
dat.controllers.FunctionController = constructor( 'dat-gui-function' );
dat.controllers.ColorController = constructor( 'dat-gui-color' );
dat.controllers.BooleanController = constructor( 'dat-gui-boolean' );
dat.controllers.OptionController = constructor( 'dat-gui-option' );
dat.controllers.NumberControllerBox = dat.controllers.NumberController;
dat.controllers.NumberControllerSlider = dat.controllers.NumberController;
function constructor( elementName ) {
return function( object, path ) {
var el = document.createElement( elementName );
el.watch( object, path );
return el;
};
}
// Export
// -------------------------------
scope.dat = dat;
scope.Gui = Gui;
})( this );

View File

@ -47,7 +47,7 @@ Polymer( 'dat-gui-base', {
map: function( x, a, b, c, d ) { map: function( x, a, b, c, d ) {
return ( x - a ) / ( b - a ) * ( d - c ) + c; return ( x - a ) / ( b - a ) * ( d - c ) + c;
}, },
// Legacy // Legacy
// ------------------------------- // -------------------------------
@ -55,7 +55,7 @@ Polymer( 'dat-gui-base', {
listen: function() { listen: function() {
Gui.warn( 'controller.listen() is deprecated. All controllers are listened for free.' ); Gui.warn( 'controller.listen() is deprecated. All controllers are listened for free.' );
return this; return this;
}, },
@ -76,7 +76,7 @@ Polymer( 'dat-gui-base', {
onChange: function( v ) { onChange: function( v ) {
this.addEventListener( 'change', function( e ) { this.addEventListener( 'change', function( e ) {
v( e.detail ); v( e.detail );
} ); } );

View File

@ -9,9 +9,7 @@ Gui.register( 'dat-gui-boolean', function( value ) {
Polymer( 'dat-gui-boolean', { Polymer( 'dat-gui-boolean', {
ready: function() { ready: function() {},
},
toggle: function() { toggle: function() {

View File

@ -158,7 +158,9 @@ Polymer( 'dat-gui-number', {
e.preventDefault(); e.preventDefault();
this._rect = this.$.track.getBoundingClientRect(); this._rect = this.$.track.getBoundingClientRect();
if ( !this._alt ) { this.value = this.valueFromX( e.x ); } if ( !this._alt ) {
this.value = this.valueFromX( e.x );
}
this.fire( 'sliderDown' ); this.fire( 'sliderDown' );
@ -184,7 +186,9 @@ Polymer( 'dat-gui-number', {
var dv = this.valueFromDX( e.ddx ); var dv = this.valueFromDX( e.ddx );
if ( this._alt ) { dv /= 10; } if ( this._alt ) {
dv /= 10;
}
this.value += dv * this._dragFriction; this.value += dv * this._dragFriction;

View File

@ -6,7 +6,7 @@ Polymer( 'dat-gui-option', {
key: null, key: null,
ready: function() { ready: function() {
this.options = {}; this.options = {};
}, },
@ -22,7 +22,7 @@ Polymer( 'dat-gui-option', {
}, this ); }, this );
} else { } else {
this.options = options; this.options = options;
} }
@ -30,7 +30,7 @@ Polymer( 'dat-gui-option', {
}, },
valueChanged: function() { valueChanged: function() {
for ( var i in this.options ) { for ( var i in this.options ) {
if ( this.options[ i ] === this.value ) { if ( this.options[ i ] === this.value ) {
this.key = i; this.key = i;
@ -39,7 +39,7 @@ Polymer( 'dat-gui-option', {
} }
this.super(); this.super();
}, },
keyChanged: function() { keyChanged: function() {
@ -51,12 +51,12 @@ Polymer( 'dat-gui-option', {
keys: function( object ) { keys: function( object ) {
if ( object ) { if ( object ) {
return Object.keys( object ); return Object.keys( object );
} }
} }
} ); } );

View File

@ -20,7 +20,7 @@ Polymer( 'dat-gui-string', {
if ( e.keyCode == 13 ) { if ( e.keyCode == 13 ) {
this.$.input.blur(); this.$.input.blur();
} }
} }

View File

@ -9,7 +9,7 @@ Polymer( 'dat-gui', {
open: true, open: true,
touch: ( 'ontouchstart' in window ) || ( !!window.DocumentTouch && document instanceof window.DocumentTouch ), touch: ( 'ontouchstart' in window ) || ( !!window.DocumentTouch && document instanceof window.DocumentTouch ),
// Observers // Observers
// ------------------------------- // -------------------------------

View File

@ -5,9 +5,7 @@ Polymer( 'gui-row', {
comment: null, comment: null,
commentOpen: false, commentOpen: false,
ready: function() { ready: function() {},
},
openComment: function() { openComment: function() {
this.commentOpen = true; this.commentOpen = true;

View File

View File

@ -1,38 +1,40 @@
// Use gui.shim.js in production when you want to use dat.gui to recall values without any of the interface. // Use gui.shim.js in production when you want to use dat.gui to recall values without any of the interface.
( function( scope ) { ( function( scope ) {
'use strict'; 'use strict';
var Gui = function() { var Gui = function() {
this.vars = {}; this.vars = {};
}; };
Gui.ready = function( fnc ) { Gui.ready = function( fnc ) {
fnc(); fnc();
}; };
Gui.prototype.var = function( name, value ) { Gui.prototype.var = function( name, value ) {
this.vars[ name ] = value; this.vars[ name ] = value;
return controllerShim; return controllerShim;
}; };
Gui.prototype.add = function( object, path ) { Gui.prototype.add = function( object, path ) {
return controllerShim; return controllerShim;
}; };
var identity = function() { return this; }; var identity = function() {
return this;
};
var controllerShim = { var controllerShim = {
on: identity on: identity
}; };
scope.Gui = Gui; scope.Gui = Gui;
} )( this ); })( this );

View File

@ -7,7 +7,7 @@
<script src="../build/dat-gui.js"></script> <script src="../build/dat-gui.js"></script>
<!-- <!--
<script src="../platform/platform.js"></script> <script src="../../platform/platform.js"></script>
<link rel="import" href="../dat-gui.html"> <link rel="import" href="../dat-gui.html">
--> -->
@ -25,6 +25,7 @@
body content. body content.
<script> <script>
/* globals Gui */
var object = { var object = {
"boolean": false, "boolean": false,
@ -40,7 +41,7 @@
// How do we kill polymer-ready ... // How do we kill polymer-ready ...
Gui.ready( function() { Gui.ready( function() {
gui = new Gui(); var gui = new Gui();
gui.panel.docked = true; gui.panel.docked = true;

View File

@ -1,55 +1,151 @@
var gulp = require( 'gulp' ), /*
nib = require( 'nib' ),
fs = require( 'fs' ),
marked = require( 'marked' ),
karma = require( 'karma' ),
browserSync = require( 'browser-sync' ),
$ = require( 'gulp-load-plugins' )();
var paths = { Main Gulp tasks
build: [ 'elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js' , 'dat-gui.html' ], -----------------
lint: [ 'gulpfile.js', 'elements/**/*.js' ],
test: [ 'build/dat-gui.js', 'tests/*.js' ],
clean: [ 'build/*', '**/*.css' ],
docs: [ 'README.md', 'docs/*' ],
shim: [ 'elements/shim.js' ]
};
gulp.task( 'default', [ 'docs', 'lint', 'shim', 'build' ] ); * default - dev
* build - create a vulcanized compiled version after linting and formatting
* dev - launch server, watch for code changes, lint, format
* docs - compile the docs and update gh-pages
* release - build js and docs and update version tag
* test - run the tests
* watch - watch for code changes and update styles but serve it yourself
gulp.task( 'watch', [ 'default' ], function() { Gulp tasks used by the main gulp tasks
--------------------------------------
* clean - remove build files
* style - convert stylus to css
* fmt - format the js with esformater
* lint - lint the js with jshint
* readme - convert the readme.md into interactive html doc
* reload - reload the webserver
* serve - start the webserver
* shim - create the shim loader
* vulcanize - vulcanize the into one file
*/
var gulp = require( 'gulp' );
gulp.task( 'default', [ 'dev' ] );
gulp.task( 'build', [ 'readme', 'lint', 'vulcanize', 'shim' ], function() {
return gulp.src( 'build/dat-gui.html' )
.pipe( $.replace( /\\/g, '\\\\' ) )
.pipe( $.replace( /'/g, '\\\'' ) )
.pipe( $.replace( /^(.*)$/gm, '\'$1\',' ) )
.pipe( $.insert.wrap( 'document.write([', '].join("\\n"))' ) )
.pipe( $.rename( 'dat-gui.js' ) )
.pipe( gulp.dest( 'build' ) );
} );
gulp.task( 'dev', [ 'watch', 'test', 'serve' ] );
gulp.task( 'docs', [ 'style', 'readme' ] );
gulp.task( 'release', function() {
console.log( 'Task not yet implemented.' );
} );
gulp.task( 'test', function() {
karma.server.start( { karma.server.start( {
frameworks: [ 'jasmine' ], frameworks: [ 'jasmine' ],
files: paths.test files: paths.test
} ); } );
gulp.watch( paths.docs, [ 'docs' ] ); } );
gulp.watch( paths.lint, [ 'lint' ] );
gulp.watch( paths.build, [ 'build' ] ); gulp.task( 'watch', [ 'build' ], function() {
gulp.watch( paths.shim, [ 'shim' ] ); // watches and builds all tasks
// gulp.watch( paths.html.concat(paths.styl).concat(paths.js).concat(paths.shim), [ 'build' ] );
gulp.watch( paths.docs, [ 'readme' ] );
gulp.watch( paths.styl, [ 'style' ] );
gulp.watch( paths.html.concat( paths.styl )
.concat( paths.js ).concat( paths.shim )
.concat( paths.docs ), [ 'reload' ] );
// fmt
$.watch( paths.js, {
base: './'
} )
.pipe( $.esformatter( formattingOptions ) )
.pipe( gulp.dest( './' ) );
} );
////////////////////////////////////////////////
gulp.task( 'clean', function() {
return gulp.src( 'build/*' )
.pipe( $.rimraf() );
} );
gulp.task( 'style', function() {
return gulp.src( paths.styl, {
base: './'
} )
.pipe( $.stylus( {
use: [ nib() ]
} ) )
.pipe( gulp.dest( './' ) )
.pipe( $.filter( '**/*.css' ) )
.pipe( $.if( browserSync.active, browserSync.reload( {
stream: true
} ) ) );
} );
gulp.task( 'fmt', function() {
return gulp.src( paths.js, {
base: './'
} )
.pipe( $.esformatter( formattingOptions ) )
.pipe( gulp.dest( './' ) );
} );
gulp.task( 'lint', [ 'fmt' ], function() {
return gulp.src( paths.js )
.pipe( browserSync.reload( {
stream: true,
once: true
} ) )
.pipe( $.jshint( '.jshintrc' ) )
.pipe( $.jshint.reporter( 'jshint-stylish' ) )
.pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) );
} );
gulp.task( 'readme', function() {
return gulp.src( 'README.md' )
.pipe( $.marked( { // convert the markdown
gfm: true, // use github flavor markdown
highlight: function( code ) { // highlight the code
return highlight.highlightAuto( code ).value;
}
} ) )
.pipe( $.wrap( {
src: 'docs/template.html'
} ) )
.pipe( $.rename( 'index.html' ) )
.pipe( gulp.dest( './' ) );
} ); } );
gulp.task( 'reload', function() { gulp.task( 'reload', function() {
browserSync.reload(); if ( browserSync.active ) {
browserSync.reload();
}
} ); } );
gulp.task( 'dev', [ 'default', 'browser' ], function() { gulp.task( 'serve', function() {
karma.server.start( {
frameworks: [ 'jasmine' ],
files: paths.test
} );
gulp.watch( paths.docs, [ 'docs', 'reload' ] );
gulp.watch( paths.lint, [ 'lint', 'reload' ] );
gulp.watch( paths.build, [ 'build', 'reload' ] );
gulp.watch( paths.shim, [ 'shim', 'reload' ] );
} );
gulp.task( 'browser', [], function() {
browserSync.init( null, { browserSync.init( null, {
browser: [ 'google-chrome', 'google chrome' ], // linux uses the - browser: [ 'google-chrome', 'google chrome' ], // linux uses the -
server: { server: {
@ -59,95 +155,73 @@ gulp.task( 'browser', [], function() {
} ); } );
} ); } );
gulp.task( 'build', [ 'vulcanize' ], function() { gulp.task( 'shim', function() {
return gulp.src( 'build/dat-gui.html' ) return gulp.src( paths.shim )
.pipe( $.replace( /\\/g, '\\\\' ) ) .pipe( $.uglify() )
.pipe( $.replace( /'/g, '\\\'' ) ) .pipe( $.rename( 'dat-gui.shim.js' ) )
.pipe( $.replace( /^(.*)$/gm, '\'$1\',' ) ) .pipe( gulp.dest( 'build' ) );
.pipe( $.insert.wrap( 'document.write([', '].join("\\n"))' ) )
.pipe( $.rename( 'dat-gui.js' ) )
.pipe( gulp.dest( 'build' ) );
} ); } );
gulp.task( 'vulcanize', [ 'css' ], function() { gulp.task( 'vulcanize', [ 'style' ], function() {
return gulp.src( 'dat-gui.html' ) return gulp.src( 'dat-gui.html' )
.pipe( $.insert.prepend( '<script src="../platform/platform.js"></script>"\n' ) ) // must use the latest version of gulp-vulcanize otherwise it grabs the file from disk
.pipe( $.insert.prepend( '<script src="../platform/platform.js"></script>\n' ) )
.pipe( $.vulcanize( { .pipe( $.vulcanize( {
dest: 'build', dest: 'build',
inline: true, inline: true,
strip: true strip: true
} ) ) } ) )
// clean up some vulcanize ... // clean up some vulcanize ...
.pipe( $.replace( /\n\n/gm, '' ) ) .pipe( $.replace( /\n\n/gm, '' ) )
.pipe( $.replace( /<!-- .* -->/gm, '' ) ) .pipe( $.replace( /<!-- .* -->/gm, '' ) )
.pipe( $.replace( /^<div hidden>undefined<\/div>\n/gm, '' ) ) .pipe( $.replace( /^<div hidden>undefined<\/div>\n/gm, '' ) )
.pipe( gulp.dest( 'build' ) );
} );
gulp.task( 'lint', [ 'jscs', 'jshint' ] );
gulp.task( 'jscs', function() {
return gulp.src( paths.lint )
.pipe( $.jscs() );
} );
gulp.task( 'jshint', function() {
return gulp.src( paths.lint )
.pipe( browserSync.reload( { stream: true, once: true } ) )
.pipe( $.jshint( '.jshintrc' ) )
.pipe( $.jshint.reporter( 'jshint-stylish' ) )
.pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) );
} );
gulp.task( 'css', function() {
return css( 'elements/**/*.styl', 'elements' );
} );
gulp.task( 'shim', function() {
return gulp.src( paths.shim )
.pipe( $.uglify() )
.pipe( $.rename( 'gui.shim.js' ) )
.pipe( gulp.dest( 'build' ) ); .pipe( gulp.dest( 'build' ) );
} ); } );
gulp.task( 'docs', function() { var nib = require( 'nib' ),
highlight = require( 'highlight.js' ),
karma = require( 'karma' ),
browserSync = require( 'browser-sync' ),
$ = require( 'gulp-load-plugins' )();
css( 'docs/*.styl', 'docs' ); var paths = {
docs: [ 'README.md', 'docs/template.html' ],
js: [ 'gulpfile.js', 'elements/**/*.js' ],
html: [ 'dat-gui.html', 'elements/**/*.html' ],
shim: [ 'elements/shim.js' ],
styl: [ 'docs/*.styl', 'elements/**/*.styl' ],
test: [ 'build/dat-gui.js', 'tests/*.js' ]
};
var content = { var formattingOptions = {
readme: marked( fs.readFileSync( 'README.md', 'utf8' ) ) 'preset': 'jquery',
}; 'plugins': [
'esformatter-quotes',
'esformatter-semicolons',
'esformatter-braces'
],
'quotes': {
'type': 'single',
'avoidEscape': false
},
'indent': {
'value': ' '
},
'whiteSpace': {
'before': {
'ArgumentListObjectExpression': 1,
'ArgumentListFunctionExpression': 1,
'ArgumentListArrayExpression': 1
},
'after': {
'ArgumentListObjectExpression': 1,
'ArgumentListFunctionExpression': 1,
'ArgumentListArrayExpression': 1
}
}
};
return gulp.src( 'docs/template.html' )
.pipe( $.plates( content ) )
.pipe( $.rename( 'index.html' ) )
.pipe( gulp.dest( './' ) );
} );
gulp.task( 'clean', function() {
return gulp.src( paths.clean )
.pipe( $.rimraf() );
} );
function css( src, dest ) {
return gulp.src( src )
.pipe( $.stylus( { use: [ nib() ] } ) )
.pipe( gulp.dest( dest ) );
}

View File

@ -15,7 +15,8 @@
<body> <body>
<!-- Copied from README.md --> <!-- Copied from README.md -->
<div id="readme"><h1 id="dat-gui">dat-gui</h1> <div id="readme">
<h1 id="dat-gui">dat-gui</h1>
<p>dat-gui creates an interface that you can use to modify variables with very little code. </p> <p>dat-gui creates an interface that you can use to modify variables with very little code. </p>
<p><a href="#basic-usage"> Basic Usage </a> <p><a href="#basic-usage"> Basic Usage </a>
<a href="#limits"> Limits </a> <a href="#limits"> Limits </a>
@ -25,72 +26,64 @@
<a href="#saving"> Saving </a></p> <a href="#saving"> Saving </a></p>
<h3 id="basic-usage">Basic Usage</h3> <h3 id="basic-usage">Basic Usage</h3>
<p>Download the <a href="todo">minified library</a> and include it in your html.</p> <p>Download the <a href="todo">minified library</a> and include it in your html.</p>
<pre><code class="lang-html">&lt;script src=&quot;gui.js&quot;&gt;&lt;/script&gt; <pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"gui.js"</span>&gt;</span><span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span></code></pre>
</code></pre>
<p>Create controllers by adding objects and their properties. dat-gui chooses a controller based on the variable&#39;s initial value.</p> <p>Create controllers by adding objects and their properties. dat-gui chooses a controller based on the variable&#39;s initial value.</p>
<pre><code class="lang-javascript">var gui = new Gui(); <pre><code class="lang-javascript"><span class="hljs-keyword">var</span> gui = <span class="hljs-keyword">new</span> Gui();
gui.add( object, &#39;numberProperty&#39;, 0, 1 ); // Slider gui.<span class="hljs-keyword">add</span>( object, <span class="hljs-string">'numberProperty'</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span> ); <span class="hljs-comment">// Slider</span>
gui.add( object, &#39;stringProperty&#39; ); // Text box gui.<span class="hljs-keyword">add</span>( object, <span class="hljs-string">'stringProperty'</span> ); <span class="hljs-comment">// Text box</span>
gui.add( object, &#39;booleanProperty&#39; ); // Check box gui.<span class="hljs-keyword">add</span>( object, <span class="hljs-string">'booleanProperty'</span> ); <span class="hljs-comment">// Check box</span>
gui.add( object, &#39;functionProperty&#39; ); // Button gui.<span class="hljs-keyword">add</span>( object, <span class="hljs-string">'functionProperty'</span> ); <span class="hljs-comment">// Button</span></code></pre>
</code></pre>
<h3 id="limits">Limits</h3> <h3 id="limits">Limits</h3>
<p>You can specify limits on numbers. A number with a min and max value becomes a slider.</p> <p>You can specify limits on numbers. A number with a min and max value becomes a slider.</p>
<pre><code class="lang-javascript">gui.add( text, &#39;growthSpeed&#39;, -5, 5 ); // Min and max <pre><code class="lang-javascript"><span class="hljs-keyword">gui</span>.<span class="hljs-built_in">add</span>( text, <span class="hljs-string">'growthSpeed'</span>, -<span class="hljs-number">5</span>, <span class="hljs-number">5</span> ); // Min <span class="hljs-built_in">and</span> <span class="hljs-built_in">max</span>
gui.add( text, &#39;noiseStrength&#39; ).step( 5 ); // Increment amount <span class="hljs-keyword">gui</span>.<span class="hljs-built_in">add</span>( text, <span class="hljs-string">'noiseStrength'</span> ).step( <span class="hljs-number">5</span> ); // Increment amount
gui.add( text, &#39;maxSize&#39; ).min( 0 ).step( 0.25 ); // Mix and match <span class="hljs-keyword">gui</span>.<span class="hljs-built_in">add</span>( text, <span class="hljs-string">'maxSize'</span> ).<span class="hljs-built_in">min</span>( <span class="hljs-number">0</span> ).step( <span class="hljs-number">0.25</span> ); // Mix <span class="hljs-built_in">and</span> <span class="hljs-built_in">match</span></code></pre>
</code></pre>
<p>You can also provide a list of accepted values for a dropdown.</p> <p>You can also provide a list of accepted values for a dropdown.</p>
<pre><code class="lang-javascript">// Choose from accepted values <pre><code class="lang-javascript"><span class="hljs-comment">// Choose from accepted values</span>
gui.add( text, &#39;message&#39;, [ &#39;pizza&#39;, &#39;chrome&#39;, &#39;hooray&#39; ] ); gui.add( text, <span class="hljs-string">'message'</span>, [ <span class="hljs-string">'pizza'</span>, <span class="hljs-string">'chrome'</span>, <span class="hljs-string">'hooray'</span> ] );
// Choose from named values <span class="hljs-comment">// Choose from named values</span>
gui.add( text, &#39;speed&#39;, { Stopped: 0, Slow: 0.1, Fast: 5 } ); gui.add( text, <span class="hljs-string">'speed'</span>, { <span class="hljs-string">Stopped:</span> <span class="hljs-number">0</span>, <span class="hljs-string">Slow:</span> <span class="hljs-number">0.1</span>, <span class="hljs-string">Fast:</span> <span class="hljs-number">5</span> } );</code></pre>
</code></pre>
<h3 id="colors">Colors</h3> <h3 id="colors">Colors</h3>
<p>dat-gui has a color selector and understands many different representations of color. The following creates color controllers for color variables of different formats.</p> <p>dat-gui has a color selector and understands many different representations of color. The following creates color controllers for color variables of different formats.</p>
<pre><code class="lang-javascript">text.color0 = &quot;#ffae23&quot;; // CSS string <pre><code class="lang-javascript"><span class="hljs-keyword">text</span>.color0 = <span class="hljs-string">"#ffae23"</span>; <span class="hljs-comment">// CSS string</span>
text.color1 = [ 0, 128, 255 ]; // RGB array <span class="hljs-keyword">text</span>.color1 = [ <span class="hljs-number">0</span>, <span class="hljs-number">128</span>, <span class="hljs-number">255</span> ]; <span class="hljs-comment">// RGB array</span>
text.color2 = [ 0, 128, 255, 0.3 ]; // RGB with alpha <span class="hljs-keyword">text</span>.color2 = [ <span class="hljs-number">0</span>, <span class="hljs-number">128</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.3</span> ]; <span class="hljs-comment">// RGB with alpha</span>
text.color3 = { h: 350, s: 0.9, v: 0.3 }; // Hue, saturation, value <span class="hljs-keyword">text</span>.color3 = { h: <span class="hljs-number">350</span>, s: <span class="hljs-number">0.9</span>, v: <span class="hljs-number">0.3</span> }; <span class="hljs-comment">// Hue, saturation, value</span>
var gui = new Gui(); var gui = new Gui();
gui.addColor(text, &#39;color0&#39;); gui.addColor(<span class="hljs-keyword">text</span>, <span class="hljs-string">'color0'</span>);
gui.addColor(text, &#39;color1&#39;); gui.addColor(<span class="hljs-keyword">text</span>, <span class="hljs-string">'color1'</span>);
gui.addColor(text, &#39;color2&#39;); gui.addColor(<span class="hljs-keyword">text</span>, <span class="hljs-string">'color2'</span>);
gui.addColor(text, &#39;color3&#39;); gui.addColor(<span class="hljs-keyword">text</span>, <span class="hljs-string">'color3'</span>);</code></pre>
</code></pre>
<h3 id="events">Events</h3> <h3 id="events">Events</h3>
<p>You can listen for events on individual controllers using an event listener syntax.</p> <p>You can listen for events on individual controllers using an event listener syntax.</p>
<pre><code class="lang-javascript">var controller = gui.add(fizzyText, &#39;maxSize&#39;, 0, 10); <pre><code class="lang-javascript"><span class="hljs-keyword">var</span> controller = gui.add(fizzyText, <span class="hljs-string">'maxSize'</span>, <span class="hljs-number">0</span>, <span class="hljs-number">10</span>);
controller.onChange(function(value) { controller.onChange(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(value)</span> </span>{
// Fires on every change, drag, keypress, etc. <span class="hljs-comment">// Fires on every change, drag, keypress, etc.</span>
}); });
controller.onFinishChange(function(value) { controller.onFinishChange(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(value)</span> </span>{
// Fires when a controller loses focus. <span class="hljs-comment">// Fires when a controller loses focus.</span>
alert(&quot;The new value is &quot; + value); alert(<span class="hljs-string">"The new value is "</span> + value);
}); });</code></pre>
</code></pre>
<h3 id="folders">Folders</h3> <h3 id="folders">Folders</h3>
<p>You can nest as many dat-gui as you want. Nested dat-gui act as collapsible folders.</p> <p>You can nest as many dat-gui as you want. Nested dat-gui act as collapsible folders.</p>
<pre><code class="lang-javascript">var gui = new Gui(); <pre><code class="lang-javascript">var <span class="hljs-keyword">gui</span> = <span class="hljs-keyword">new</span> Gui();
var f1 = gui.addFolder(&#39;Flow Field&#39;); var f1 = <span class="hljs-keyword">gui</span>.addFolder(<span class="hljs-string">'Flow Field'</span>);
f1.add(text, &#39;speed&#39;); f1.<span class="hljs-built_in">add</span>(text, <span class="hljs-string">'speed'</span>);
f1.add(text, &#39;noiseStrength&#39;); f1.<span class="hljs-built_in">add</span>(text, <span class="hljs-string">'noiseStrength'</span>);
var f2 = gui.addFolder(&#39;Letters&#39;); var f2 = <span class="hljs-keyword">gui</span>.addFolder(<span class="hljs-string">'Letters'</span>);
f2.add(text, &#39;growthSpeed&#39;); f2.<span class="hljs-built_in">add</span>(text, <span class="hljs-string">'growthSpeed'</span>);
f2.add(text, &#39;maxSize&#39;); f2.<span class="hljs-built_in">add</span>(text, <span class="hljs-string">'maxSize'</span>);
f2.open(); f2.<span class="hljs-keyword">open</span>();</code></pre>
</code></pre>
<p>The comment method adds a tooltip to a controller.</p> <p>The comment method adds a tooltip to a controller.</p>
<pre><code class="lang-javascript">f2.add(text, &#39;message&#39;).comment( &#39;This is the comment.&#39; ); <pre><code class="lang-javascript">f2.add(text, <span class="hljs-attribute">'message</span>').comment( <span class="hljs-attribute">'This</span> <span class="hljs-keyword">is</span> the comment.' );</code></pre>
</code></pre>
<h3 id="saving">Saving</h3> <h3 id="saving">Saving</h3>
<p>Add a save menu to the interface by calling <code>gui.remember</code> on all the objects you&#39;ve added to the Gui.</p> <p>Add a save menu to the interface by calling <code>gui.remember</code> on all the objects you&#39;ve added to the Gui.</p>
<pre><code class="lang-javascript">var fizzyText = new FizzyText(); <pre><code class="lang-javascript">var fizzyText = new FizzyText();
@ -98,59 +91,52 @@ var gui = new Gui();
gui.remember(fizzyText); gui.remember(fizzyText);
// Add controllers ... // Add controllers <span class="hljs-keyword">...</span></code></pre>
</code></pre>
<p>Click the gear icon to change your save settings. You can either save your dat-gui values to localStorage, or by copying and pasting a JSON object into your source code as follows:</p> <p>Click the gear icon to change your save settings. You can either save your dat-gui values to localStorage, or by copying and pasting a JSON object into your source code as follows:</p>
<pre><code class="lang-javascript">var fizzyText = new FizzyText(); <pre><code class="lang-javascript">var fizzyText = new FizzyText();
var gui = new Gui( { load: JSON } ); var gui = new Gui( { load: JSON } );
gui.remember( fizzyText ); gui.remember( fizzyText );
// Add controllers ... // Add controllers <span class="hljs-keyword">...</span></code></pre>
</code></pre>
<h3 id="presets">Presets</h3> <h3 id="presets">Presets</h3>
<p>The save menu also allows you to save all of your settings as presets. Click Save to modify the current preset, or New to create a new preset from existing settings. Clicking Revert will clear all unsaved changes to the current preset.</p> <p>The save menu also allows you to save all of your settings as presets. Click Save to modify the current preset, or New to create a new preset from existing settings. Clicking Revert will clear all unsaved changes to the current preset.</p>
<p>Switch between presets using the dropdown in the save menu. You can specify the default like this:</p> <p>Switch between presets using the dropdown in the save menu. You can specify the default like this:</p>
<pre><code class="lang-javascript">var gui = new Gui({ <pre><code class="lang-javascript"><span class="hljs-keyword">var</span> gui = <span class="hljs-keyword">new</span> Gui({
load: JSON, load: <span class="hljs-built_in">JSON</span>,
preset: &#39;Flow&#39; preset: <span class="hljs-string">'Flow'</span>
}); });</code></pre>
</code></pre>
<p>A word of caution about localStorage:</p> <p>A word of caution about localStorage:</p>
<p>Paste the JSON save object into your source frequently. Using localStorage to save presets can make you faster, but its easy to lose your settings by clearing browsing data, changing browsers, or even by changing the URL of the page you&#39;re working on.</p> <p>Paste the JSON save object into your source frequently. Using localStorage to save presets can make you faster, but its easy to lose your settings by clearing browsing data, changing browsers, or even by changing the URL of the page you&#39;re working on.</p>
<h3 id="save-to-disk">Save to Disk</h3> <h3 id="save-to-disk">Save to Disk</h3>
<p>dat-gui comes with a node server that saves your settings to disk. This way you don&#39;t have to worry about losing your values to local storage or copying and pasting a JSON string.</p> <p>dat-gui comes with a node server that saves your settings to disk. This way you don&#39;t have to worry about losing your values to local storage or copying and pasting a JSON string.</p>
<p>First, run the node script:</p> <p>First, run the node script:</p>
<pre><code class="lang-sh">$ node gui-server <pre><code class="lang-sh"><span class="hljs-variable">$ </span>node gui-server</code></pre>
</code></pre>
<p>Next, instantiate your Gui with a path to a JSON file to store settings. dat-gui will read from this file on load and write to this file on change.</p> <p>Next, instantiate your Gui with a path to a JSON file to store settings. dat-gui will read from this file on load and write to this file on change.</p>
<pre><code class="lang-javascript">var gui = new Gui( { load: &#39;path/to/file.json&#39; } ); <pre><code class="lang-javascript"><span class="hljs-keyword">var</span> gui = <span class="hljs-keyword">new</span> Gui( { load: <span class="hljs-string">'path/to/file.json'</span> } );</code></pre>
</code></pre>
<h3 id="custom-placement">Custom Placement</h3> <h3 id="custom-placement">Custom Placement</h3>
<p>By default, Gui panels are created with fixed position, and are automatically appended to the body. You can change this behavior by setting the <code>autoPlace</code> parameter to <code>false</code>.</p> <p>By default, Gui panels are created with fixed position, and are automatically appended to the body. You can change this behavior by setting the <code>autoPlace</code> parameter to <code>false</code>.</p>
<pre><code class="lang-javascript">var gui = new Gui( { autoPlace: false } ); <pre><code class="lang-javascript"><span class="hljs-reserved">var</span> gui = <span class="hljs-keyword">new</span> Gui( { <span class="hljs-attribute">autoPlace</span>: <span class="hljs-literal">false</span> } );
var customContainer = document.getElementById(&#39;my-gui-container&#39;); <span class="hljs-reserved">var</span> customContainer = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'my-gui-container'</span>);
customContainer.appendChild(gui.domElement); customContainer.appendChild(gui.domElement);</code></pre>
</code></pre>
<p>Since dat-gui is built using <a href="todo">Web Components</a>, you can also use HTML syntax to add controllers to the page.</p> <p>Since dat-gui is built using <a href="todo">Web Components</a>, you can also use HTML syntax to add controllers to the page.</p>
<pre><code class="lang-html">&lt;body&gt; <pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>
&lt;dat-gui-number min=&quot;-2&quot; max=&quot;2&quot; step=&quot;1&quot; value=&quot;0&quot;&gt;&lt;/dat-gui-number&gt; <span class="hljs-tag">&lt;<span class="hljs-title">dat-gui-number</span> <span class="hljs-attribute">min</span>=<span class="hljs-value">"-2"</span> <span class="hljs-attribute">max</span>=<span class="hljs-value">"2"</span> <span class="hljs-attribute">step</span>=<span class="hljs-value">"1"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"0"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">dat-gui-number</span>&gt;</span>
&lt;script&gt; <span class="hljs-tag">&lt;<span class="hljs-title">script</span>&gt;</span><span class="javascript">
var controller = document.querySelector( &#39;dat-gui-number&#39; ); <span class="hljs-keyword">var</span> controller = <span class="hljs-built_in">document</span>.querySelector( <span class="hljs-string">'dat-gui-number'</span> );
controller.onChange( function() { controller.onChange( <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span> </span>{
// react to UI changes ... <span class="hljs-comment">// react to UI changes ...</span>
} ); } );
&lt;/script&gt; </span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
&lt;/body&gt; <span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span></code></pre>
</code></pre>
<h3 id="defining-custom-controllers">Defining Custom Controllers</h3> <h3 id="defining-custom-controllers">Defining Custom Controllers</h3>
<p>dat-gui uses <a href="todo">Polymer</a> under the hood to define custom elements. A dat-gui controller is just a <a href="todo">Polymer element</a> with two important requirements:</p> <p>dat-gui uses <a href="todo">Polymer</a> under the hood to define custom elements. A dat-gui controller is just a <a href="todo">Polymer element</a> with two important requirements:</p>
<ul> <ul>
@ -158,37 +144,34 @@ controller.onChange( function() {
<li>Controllers must be associated with a data type.</li> <li>Controllers must be associated with a data type.</li>
</ul> </ul>
<p>Take for example this (simplified) source for dat-gui&#39;s <code>&lt;dat-gui-number&gt;</code>:</p> <p>Take for example this (simplified) source for dat-gui&#39;s <code>&lt;dat-gui-number&gt;</code>:</p>
<pre><code class="lang-javascript">Polymer( &#39;dat-gui-number&#39;, { <pre><code class="lang-javascript">Polymer( <span class="hljs-string">'dat-gui-number'</span>, {
// Define element ... // Define element <span class="hljs-keyword">...</span>
} ); } );
Gui.register( &#39;dat-gui-number&#39;, function( value ) { Gui.register( <span class="hljs-string">'dat-gui-number'</span>, <span class="hljs-keyword">function</span>( value ) {
return typeof value == &#39;number&#39;; <span class="hljs-keyword">return</span> typeof value == <span class="hljs-string">'number'</span>;
} ); } );</code></pre>
</code></pre>
<p><code>Gui.register</code> takes an element name and a test function. The test function tells dat-gui to add a <code>&lt;dat-gui-number&gt;</code> to the panel when the user adds a variable whose type is <code>&#39;number&#39;</code>.</p> <p><code>Gui.register</code> takes an element name and a test function. The test function tells dat-gui to add a <code>&lt;dat-gui-number&gt;</code> to the panel when the user adds a variable whose type is <code>&#39;number&#39;</code>.</p>
<p>A test function determines if a controller is appropriate for a given value. This example registers <code>&lt;vector-controller&gt;</code> for values that have properties <code>x</code>, <code>y</code> and <code>z</code>.</p> <p>A test function determines if a controller is appropriate for a given value. This example registers <code>&lt;vector-controller&gt;</code> for values that have properties <code>x</code>, <code>y</code> and <code>z</code>.</p>
<pre><code class="lang-javascript">Gui.register( &#39;vector-controller&#39;, function( value ) { <pre><code class="lang-javascript">Gui.register( <span class="hljs-string">'vector-controller'</span>, function( <span class="hljs-keyword">value</span> ) {
return value.hasOwnProperty( &#39;x&#39; ) &amp;&amp; <span class="hljs-keyword">return</span> <span class="hljs-keyword">value</span>.hasOwnProperty( <span class="hljs-string">'x'</span> ) &amp;&amp;
value.hasOwnProperty( &#39;y&#39; ) &amp;&amp; <span class="hljs-keyword">value</span>.hasOwnProperty( <span class="hljs-string">'y'</span> ) &amp;&amp;
value.hasOwnProperty( &#39;z&#39; ); <span class="hljs-keyword">value</span>.hasOwnProperty( <span class="hljs-string">'z'</span> );
} ); } );</code></pre>
</code></pre>
<h3 id="publishing-custom-controllers">Publishing Custom Controllers</h3> <h3 id="publishing-custom-controllers">Publishing Custom Controllers</h3>
<p>You should use <a href="todo">Bower</a> and format your plugin all nice and it should have a certain prefix yada yada.</p> <p>You should use <a href="todo">Bower</a> and format your plugin all nice and it should have a certain prefix yada yada.</p>
<p>Installing third-party controllers ... </p> <p>Installing third-party controllers ... </p>
<pre><code class="lang-sh">$ bower install gui-three <pre><code class="lang-sh"><span class="hljs-variable">$ </span>bower install gui-three</code></pre>
</code></pre>
<p>Include the source for the third-party controllers after dat-gui.</p> <p>Include the source for the third-party controllers after dat-gui.</p>
<pre><code class="lang-html">&lt;script src=&quot;gui.js&quot;&gt;&lt;/script&gt; <pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"gui.js"</span>&gt;</span><span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
&lt;script src=&quot;gui-three.js&quot;&gt;&lt;/script&gt; <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"gui-three.js"</span>&gt;</span><span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span></code></pre>
</code></pre>
</div> </div>
<script src="docs/main.js"></script> <script src="docs/main.js"></script>

View File

@ -3,26 +3,31 @@
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "devDependencies": {
"browser-sync": "^1.3.6", "browser-sync": "^1.3.6",
"esformatter-braces": "^0.1.7",
"esformatter-quotes": "^1.0.0",
"esformatter-semicolons": "^1.0.3",
"gulp": "^3.8.7", "gulp": "^3.8.7",
"gulp-esformatter": "^1.0.0",
"gulp-filter": "^1.0.2",
"gulp-if": "^1.2.4", "gulp-if": "^1.2.4",
"gulp-insert": "^0.4.0", "gulp-insert": "^0.4.0",
"gulp-jscs": "^1.1.2",
"gulp-jshint": "^1.8.4", "gulp-jshint": "^1.8.4",
"gulp-load-plugins": "^0.6.0", "gulp-load-plugins": "^0.6.0",
"gulp-plates": "0.0.5", "gulp-marked": "^0.2.0",
"gulp-reload": "0.0.4",
"gulp-rename": "^1.2.0", "gulp-rename": "^1.2.0",
"gulp-replace": "^0.4.0", "gulp-replace": "^0.4.0",
"gulp-rimraf": "^0.1.0", "gulp-rimraf": "^0.1.0",
"gulp-stylus": "^1.3.0", "gulp-stylus": "^1.3.0",
"gulp-uglify": "^1.0.1", "gulp-uglify": "^1.0.1",
"gulp-vulcanize": "^1.0.0", "gulp-vulcanize": "^1.1.0",
"gulp-watch": "^0.6.9", "gulp-watch": "^1.0.3",
"gulp-wrap": "^0.3.0",
"highlight.js": "^8.2.0",
"jshint-stylish": "^0.4.0", "jshint-stylish": "^0.4.0",
"karma": "^0.12.23", "karma": "^0.12.23",
"karma-chrome-launcher": "^0.1.4", "karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5", "karma-jasmine": "^0.1.5",
"marked": "^0.3.2", "nib": "^1.0.3",
"nib": "^1.0.3" "through2": "^0.6.1"
} }
} }