Remove __options.stats and load Stats library automatically only when in dev mode on the browser.

This commit is contained in:
Jürg Lehni 2014-08-16 19:11:16 +02:00
parent 21c9f97450
commit a2b7f9fc11
3 changed files with 14 additions and 19 deletions

View file

@ -44,7 +44,6 @@ if (typeof window === 'object') {
prepro.setOptions({ prepro.setOptions({
environment: 'node', environment: 'node',
legacy: false, legacy: false,
stats: false,
version: 'dev' version: 'dev'
}); });
// Load Paper.js library files. // Load Paper.js library files.

View file

@ -19,11 +19,9 @@
// publishes the various JSON package files automatically. // publishes the various JSON package files automatically.
var version = '0.9.19'; var version = '0.9.19';
var inBrowser = typeof window === 'object';
var __options = { var __options = {
// If this file is loaded in the browser, we're in dev mode through load.js // If this file is loaded in the browser, we're in dev mode through load.js
version: inBrowser ? 'dev' : version, version: typeof window === 'object' ? 'dev' : version,
environment: 'browser', environment: 'browser',
parser: 'acorn', parser: 'acorn',
legacy: true, legacy: true,
@ -33,7 +31,5 @@ var __options = {
nativeContains: false, nativeContains: false,
paperScript: true, paperScript: true,
palette: true, palette: true,
// Only load stats when in dev mode
stats: inBrowser,
debug: false debug: false
}; };

View file

@ -36,17 +36,17 @@ var paper = new function(undefined) {
// Inline Straps.js core (the Base class) inside the paper scope first: // Inline Straps.js core (the Base class) inside the paper scope first:
/*#*/ include('../bower_components/straps/straps.js', { exports: false }); /*#*/ include('../bower_components/straps/straps.js', { exports: false });
/*#*/ if (__options.stats) { /*#*/ if (__options.version == 'dev' && __options.environment == 'browser') {
/*#*/ include('../bower_components/stats.js/build/stats.min.js'); /*#*/ include('../bower_components/stats.js/build/stats.min.js');
/*#*/ } // __options.stats /*#*/ }
/*#*/ if (__options.legacy) { /*#*/ if (__options.legacy) {
/*#*/ include('legacy.js'); /*#*/ include('legacy.js');
/*#*/ } // __options.legacy /*#*/ }
/*#*/ if (__options.version == 'dev') { /*#*/ if (__options.version == 'dev') {
/*#*/ include('constants.js'); /*#*/ include('constants.js');
/*#*/ } // __options.version == 'dev' /*#*/ }
/*#*/ include('core/Base.js'); /*#*/ include('core/Base.js');
/*#*/ include('core/Callback.js'); /*#*/ include('core/Callback.js');
@ -87,7 +87,7 @@ var paper = new function(undefined) {
/*#*/ include('path/CompoundPath.js'); /*#*/ include('path/CompoundPath.js');
/*#*/ if (__options.booleanOperations) { /*#*/ if (__options.booleanOperations) {
/*#*/ include('path/PathItem.Boolean.js'); /*#*/ include('path/PathItem.Boolean.js');
/*#*/ } // __options.booleanOperations /*#*/ }
/*#*/ include('path/PathFlattener.js'); /*#*/ include('path/PathFlattener.js');
/*#*/ include('path/PathFitter.js'); /*#*/ include('path/PathFitter.js');
@ -101,12 +101,12 @@ var paper = new function(undefined) {
/*#*/ if (__options.environment == 'node') { /*#*/ if (__options.environment == 'node') {
/*#*/ include('dom/node.js'); /*#*/ include('dom/node.js');
/*#*/ } // __options.environment == 'node' /*#*/ }
/*#*/ include('dom/DomElement.js'); /*#*/ include('dom/DomElement.js');
/*#*/ if (__options.environment == 'browser') { /*#*/ if (__options.environment == 'browser') {
// DomEvent doesn't make sense outside of the browser (yet) // DomEvent doesn't make sense outside of the browser (yet)
/*#*/ include('dom/DomEvent.js'); /*#*/ include('dom/DomEvent.js');
/*#*/ } // __options.environment == 'browser' /*#*/ }
/*#*/ include('ui/View.js'); /*#*/ include('ui/View.js');
/*#*/ include('ui/CanvasView.js'); /*#*/ include('ui/CanvasView.js');
@ -120,7 +120,7 @@ var paper = new function(undefined) {
/*#*/ if (__options.palette) { /*#*/ if (__options.palette) {
/*#*/ include('ui/Palette.js'); /*#*/ include('ui/Palette.js');
/*#*/ include('ui/Component.js'); /*#*/ include('ui/Component.js');
/*#*/ } // __options.palette /*#*/ }
/*#*/ include('tool/ToolEvent.js'); /*#*/ include('tool/ToolEvent.js');
/*#*/ include('tool/Tool.js'); /*#*/ include('tool/Tool.js');
@ -128,25 +128,25 @@ var paper = new function(undefined) {
// Http is used both for PaperScript and SVGImport // Http is used both for PaperScript and SVGImport
/*#*/ if (__options.paperScript || __options.svg) { /*#*/ if (__options.paperScript || __options.svg) {
/*#*/ include('net/Http.js'); /*#*/ include('net/Http.js');
/*#*/ } // __options.paperScript || __options.svg /*#*/ }
/*#*/ } // __options.environment == 'browser' /*#*/ } // __options.environment == 'browser'
/*#*/ include('canvas/CanvasProvider.js'); /*#*/ include('canvas/CanvasProvider.js');
/*#*/ include('canvas/BlendMode.js'); /*#*/ include('canvas/BlendMode.js');
/*#*/ if (__options.version == 'dev') { /*#*/ if (__options.version == 'dev') {
/*#*/ include('canvas/ProxyContext.js'); /*#*/ include('canvas/ProxyContext.js');
/*#*/ } // __options.environment == 'browser' /*#*/ }
/*#*/ if (__options.svg) { /*#*/ if (__options.svg) {
/*#*/ include('svg/SVGStyles.js'); /*#*/ include('svg/SVGStyles.js');
/*#*/ include('svg/SVGNamespaces.js'); /*#*/ include('svg/SVGNamespaces.js');
/*#*/ include('svg/SVGExport.js'); /*#*/ include('svg/SVGExport.js');
/*#*/ include('svg/SVGImport.js'); /*#*/ include('svg/SVGImport.js');
/*#*/ } // __options.svg /*#*/ }
/*#*/ if (__options.paperScript) { /*#*/ if (__options.paperScript) {
/*#*/ include('core/PaperScript.js'); /*#*/ include('core/PaperScript.js');
/*#*/ } // __options.paperScript /*#*/ }
/*#*/ include('export.js'); /*#*/ include('export.js');
return paper; return paper;