mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 16:36:15 -04:00
Minify implements virtual plugins resources.
This commit is contained in:
parent
1a1f222221
commit
0d6ec8c04a
2 changed files with 19 additions and 25 deletions
|
@ -27,6 +27,7 @@ var cleanCSS = require('clean-css');
|
|||
var jsp = require("uglify-js").parser;
|
||||
var pro = require("uglify-js").uglify;
|
||||
var path = require('path');
|
||||
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
|
||||
var RequireKernel = require('require-kernel');
|
||||
var server = require('../server');
|
||||
|
||||
|
@ -63,6 +64,22 @@ exports.minify = function(req, res, next)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Handle static files for plugins:
|
||||
paths like "plugins/ep_myplugin/static/js/test.js"
|
||||
are rewritten into ROOT_PATH_OF_MYPLUGIN/static/js/test.js,
|
||||
commonly ETHERPAD_ROOT/node_modules/ep_myplugin/static/js/test.js
|
||||
*/
|
||||
var match = filename.match(/^plugins\/([^\/]+)\/static\/(.*)/);
|
||||
if (match) {
|
||||
var pluginName = match[1];
|
||||
var resourcePath = match[2];
|
||||
var plugin = plugins.plugins[pluginName];
|
||||
if (plugin) {
|
||||
var pluginPath = plugin.package.realPath;
|
||||
filename = path.relative(ROOT_DIR, pluginPath + '/static/' + resourcePath);
|
||||
}
|
||||
}
|
||||
|
||||
// What content type should this be?
|
||||
// TODO: This should use a MIME module.
|
||||
var contentType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue