From 112fc7a688a8fde3e20a1b761f91cadadde2e77a Mon Sep 17 00:00:00 2001 From: Michael Deal Date: Wed, 21 Nov 2012 02:11:19 -0800 Subject: [PATCH] add grunt.js, update color libraries --- build.sh | 14 -------------- grunt.js | 22 ++++++++++++++++++++++ js/Color/SpaceW3.js | 17 +++++++++++++---- 3 files changed, 35 insertions(+), 18 deletions(-) delete mode 100755 build.sh create mode 100644 grunt.js diff --git a/build.sh b/build.sh deleted file mode 100755 index 2ecdf14..0000000 --- a/build.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -mkdir -p build -OUT=build/MIDI.minimal.js - -echo "//MIDI.js minimal Browserify wrapper" > $OUT - -for file in js/DOMLoader.*.js js/Polyfill/Base64.js inc/base64binary.js js/MIDI.*.js -do - cat $file >> $OUT - echo "" >> $OUT -done - -echo "if (typeof module !== 'undefined') module.exports = MIDI;" >> $OUT \ No newline at end of file diff --git a/grunt.js b/grunt.js new file mode 100644 index 0000000..ca4b6d6 --- /dev/null +++ b/grunt.js @@ -0,0 +1,22 @@ +/* + Build environment + ---------------------------------------- + 1) Install NodeJS: + http://nodejs.org/ + 2) Install Grunt + npm install grunt +*/ + +module.exports = function (grunt) { + grunt.initConfig({ + concat: { + 'build/MIDI.js': "./js/**" + }, + min: { + 'build/MIDI.min.js': ['build/MIDI.js'] + } + }); + /// + grunt.registerTask('default', 'concat min'); + /// +}; \ No newline at end of file diff --git a/js/Color/SpaceW3.js b/js/Color/SpaceW3.js index f434282..46da7f2 100644 --- a/js/Color/SpaceW3.js +++ b/js/Color/SpaceW3.js @@ -1,6 +1,8 @@ /* ---------------------------------------------------- - Color Space : 1.2 : 2012.09.01 : http://mudcu.be + Color Space : 1.2 : 2012.11.06 + ---------------------------------------------------- + https://github.com/mudcube/Color.Space.js ---------------------------------------------------- RGBA <-> HSLA <-> W3 RGBA <-> HSVA @@ -25,14 +27,17 @@ #000000 */ -if (typeof(Color) === "undefined") Color = {}; +if (typeof(Color) === "undefined") var Color = {}; if (typeof(Color.Space) === "undefined") Color.Space = {}; (function () { "use strict"; +var useEval = false; // caches functions for quicker access. + var functions = { // holds generated cached conversion functions. }; + var shortcuts = { "HEX24>HSL": "HEX24>RGB>HSL", "HEX32>HSLA": "HEX32>RGBA>HSLA", @@ -65,9 +70,13 @@ var root = Color.Space = function(color, route) { } key += (pos === 0 ? "" : "_") + r[pos]; color = root[key](color); -// f = "Color.Space."+key+"("+f+")"; + if (useEval) { + f = "Color.Space."+key+"("+f+")"; + } } -// functions[route] = eval("(function(color) { return "+f+" })"); + if (useEval) { + functions[route] = eval("(function(color) { return "+f+" })"); + } return color; };