Import subset of underscore.string scripts only

Require individual methods like `classify` instead of the whole module.
This reduces the size of the browser bundle from ~27kb down to ~2kb.
This commit is contained in:
Miroslav Bajtoš 2015-03-25 14:02:16 +01:00
parent 911d8323b4
commit 7528cbb712
2 changed files with 2 additions and 10 deletions

View File

@ -8,7 +8,8 @@ var assert = require('assert');
var fs = require('fs'); var fs = require('fs');
var extend = require('util')._extend; var extend = require('util')._extend;
var RemoteObjects = require('strong-remoting'); var RemoteObjects = require('strong-remoting');
var stringUtils = require('underscore.string'); var classify = require('underscore.string/classify');
var camelize = require('underscore.string/camelize');
var path = require('path'); var path = require('path');
/** /**
@ -361,14 +362,6 @@ app.boot = function(options) {
'`app.boot` was removed, use the new module loopback-boot instead'); '`app.boot` was removed, use the new module loopback-boot instead');
}; };
function classify(str) {
return stringUtils.classify(str);
}
function camelize(str) {
return stringUtils.camelize(str);
}
function dataSourcesFromConfig(config, connectorRegistry) { function dataSourcesFromConfig(config, connectorRegistry) {
var connectorPath; var connectorPath;

View File

@ -6,7 +6,6 @@ var assert = require('assert');
var RemoteObjects = require('strong-remoting'); var RemoteObjects = require('strong-remoting');
var SharedClass = require('strong-remoting').SharedClass; var SharedClass = require('strong-remoting').SharedClass;
var extend = require('util')._extend; var extend = require('util')._extend;
var stringUtils = require('underscore.string');
/** /**
* The base class for **all models**. * The base class for **all models**.