|
|
|
@ -250,6 +250,7 @@ var fs = require('fs'),
|
|
|
|
|
jsPaths = scripts.map(function (jsPath) {
|
|
|
|
|
jsPath = path.normalize(jsPath);
|
|
|
|
|
|
|
|
|
|
// The filter:scripts.get plugin will be deprecated as of v0.5.0, specify scripts in plugin.json instead
|
|
|
|
|
if (jsPath.substring(0, 7) === 'plugins') {
|
|
|
|
|
var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) {
|
|
|
|
|
if (jsPath.match(mappedPath)) {
|
|
|
|
@ -271,15 +272,18 @@ var fs = require('fs'),
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Remove scripts that could not be found (remove this line at v0.5.0)
|
|
|
|
|
Meta.js.scripts = jsPaths.filter(function(path) { return path !== null });
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== 'development') {
|
|
|
|
|
callback(null, [
|
|
|
|
|
Meta.js.minFile
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
callback(null, scripts);
|
|
|
|
|
}
|
|
|
|
|
// Add socket.io client library
|
|
|
|
|
Meta.js.scripts.push(path.join(__dirname, '../node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js'));
|
|
|
|
|
|
|
|
|
|
// Add plugin scripts
|
|
|
|
|
Meta.js.scripts = Meta.js.scripts.concat(plugins.clientScripts);
|
|
|
|
|
|
|
|
|
|
callback(null, [
|
|
|
|
|
Meta.js.minFile
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
minify: function (callback) {
|
|
|
|
@ -294,6 +298,22 @@ var fs = require('fs'),
|
|
|
|
|
minified = uglifyjs.minify(jsPaths);
|
|
|
|
|
this.cache = minified.code;
|
|
|
|
|
callback();
|
|
|
|
|
},
|
|
|
|
|
compress: function(callback) {
|
|
|
|
|
var uglifyjs = require('uglify-js'),
|
|
|
|
|
jsPaths = this.scripts,
|
|
|
|
|
compressed;
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
|
winston.info('Compressing client-side libraries into one file');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
minified = uglifyjs.minify(jsPaths, {
|
|
|
|
|
mangle: false,
|
|
|
|
|
compress: false
|
|
|
|
|
});
|
|
|
|
|
this.cache = minified.code;
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|