From 8a70c838b9ed754e7e5fd74890f75ccbe38b98ed Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Mon, 8 Sep 2014 18:01:13 -0400 Subject: [PATCH 1/2] no message --- TODO.md | 5 +++++ examples/index.html | 4 ++-- gulpfile.js | 16 +++++++++++++--- package.json | 1 + 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 6aa03f6..18a586c 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,11 @@ BUILD - [x] single import +REFACTOR + +- [ ] controller-* => gui-* +- [ ] gui.define* => gui.var* + PARITY - [ ] folders diff --git a/examples/index.html b/examples/index.html index 78f10e3..bf634d3 100644 --- a/examples/index.html +++ b/examples/index.html @@ -6,8 +6,8 @@ dat-gui kitchen sink - - + + diff --git a/gulpfile.js b/gulpfile.js index 980d50f..2a387ca 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,10 +11,11 @@ var paths = { lint: [ 'gulpfile.js', 'elements/**/*.js' ], test: [ 'build/gui.js', 'tests/*.js' ], clean: [ 'build/*', '**/*.css' ], - docs: [ 'README.md', 'docs/*' ] + docs: [ 'README.md', 'docs/*' ], + shim: [ 'elements/shim.js' ] }; -gulp.task( 'default', [ 'docs', 'lint', 'build' ] ); +gulp.task( 'default', [ 'docs', 'lint', 'shim', 'build' ] ); gulp.task( 'watch', [ 'default' ], function() { @@ -26,6 +27,7 @@ gulp.task( 'watch', [ 'default' ], function() { gulp.watch( paths.docs, [ 'docs' ] ); gulp.watch( paths.lint, [ 'lint' ] ); gulp.watch( paths.build, [ 'build' ] ); + gulp.watch( paths.shim, [ 'shim' ] ); } ); @@ -76,13 +78,21 @@ gulp.task( 'jshint', function() { } ); - 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' ) ); + +} ); + gulp.task( 'docs', function() { css( 'docs/*.styl', 'docs' ); diff --git a/package.json b/package.json index 126d265..2898a14 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "gulp-replace": "^0.4.0", "gulp-rimraf": "^0.1.0", "gulp-stylus": "^1.3.0", + "gulp-uglify": "^1.0.1", "gulp-vulcanize": "^1.0.0", "gulp-watch": "^0.6.9", "jshint-stylish": "^0.4.0", From 338a0bbb77453c326083eb2dbdb1c46cdb610a85 Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Mon, 8 Sep 2014 18:01:19 -0400 Subject: [PATCH 2/2] shim --- build/gui.shim.js | 1 + elements/shim.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 build/gui.shim.js create mode 100644 elements/shim.js diff --git a/build/gui.shim.js b/build/gui.shim.js new file mode 100644 index 0000000..95a09d2 --- /dev/null +++ b/build/gui.shim.js @@ -0,0 +1 @@ +!function(n){"use strict";var t=function(){this.defined={}};t.ready=function(n){n()},t.prototype.define=function(n,t){return this.defined[n]=t,e},t.prototype.add=function(){return e};var i=function(){return this},e={on:i};n.Gui=t}(this); \ No newline at end of file diff --git a/elements/shim.js b/elements/shim.js new file mode 100644 index 0000000..d03f2bd --- /dev/null +++ b/elements/shim.js @@ -0,0 +1,39 @@ +// Use gui.shim.js in production when you want to use dat.gui to recall values without any of the interface. +( function( scope ) { + + 'use strict'; + + var Gui = function() { + + this.defined = {}; + + }; + + Gui.ready = function( fnc ) { + + fnc(); + + }; + + Gui.prototype.define = function( name, value ) { + + this.defined[ name ] = value; + return controllerShim; + + }; + + Gui.prototype.add = function( object, path ) { + + return controllerShim; + + }; + + var identity = function() { return this; }; + + var controllerShim = { + on: identity + }; + + scope.Gui = Gui; + +} )( this ); \ No newline at end of file