From fdfdf9635703552747e979c52675c4ec8c1f3f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 27 Jun 2013 14:41:25 -0700 Subject: [PATCH] Make load.sh work for Node.js too --- build/load.sh | 12 ++++++++++-- src/load.js | 5 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/load.sh b/build/load.sh index 7c7a37ad..d04fb1b9 100755 --- a/build/load.sh +++ b/build/load.sh @@ -10,11 +10,19 @@ # # All rights reserved. -# This script simply copies src/load.js to dist/paper.js to, which loads the -# library from separate sources through PrePro. +# This script simply copies src/load.js to dist/paper.js and dist/paper-node.js, +# which loads the library from separate sources through PrePro both in the +# browser and in Node.js. if [ -f ../dist/paper.js ] then rm ../dist/paper.js fi + +if [ -f ../dist/paper-node.js ] +then + rm ../dist/paper-node.js +fi + cp ../src/load.js ../dist/paper.js +cp ../src/load.js ../dist/paper-node.js diff --git a/src/load.js b/src/load.js index 2a6d111a..e8ce2548 100644 --- a/src/load.js +++ b/src/load.js @@ -39,7 +39,8 @@ if (typeof window !== 'undefined') { // Node based loading through PrePro: var prepro = require('prepro/lib/node.js'); // Include deafult browser options. - prepro.include('options.js'); + // Step out and back into src in case this is loaded from dist/paper-node.js + prepro.include('../src/options.js'); // Override node specific options. prepro.setOptions({ browser: false, @@ -47,5 +48,5 @@ if (typeof window !== 'undefined') { stats: false }); // Load Paper.js library files. - prepro.include('paper.js'); + prepro.include('../src/paper.js'); }