mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Minify: Compatibility for all vendors/*.js
files
This commit is contained in:
parent
b0d78d662e
commit
99b3918f2c
1 changed files with 14 additions and 5 deletions
|
@ -123,6 +123,15 @@ const sanitizePathname = (p) => {
|
||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const compatPaths = {
|
||||||
|
'js/browser.js': 'js/vendors/browser.js',
|
||||||
|
'js/farbtastic.js': 'js/vendors/farbtastic.js',
|
||||||
|
'js/gritter.js': 'js/vendors/gritter.js',
|
||||||
|
'js/html10n.js': 'js/vendors/html10n.js',
|
||||||
|
'js/jquery.js': 'js/vendors/jquery.js',
|
||||||
|
'js/nice-select.js': 'js/vendors/nice-select.js',
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates the minifed javascript for the given minified name
|
* creates the minifed javascript for the given minified name
|
||||||
* @param req the Express request
|
* @param req the Express request
|
||||||
|
@ -139,11 +148,11 @@ const minify = async (req, res) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backward compatibility for plugins that were written when jQuery lived at
|
// Backward compatibility for plugins that require() files from old paths.
|
||||||
// src/static/js/jquery.js.
|
const newLocation = compatPaths[filename.replace(/^plugins\/ep_etherpad-lite\/static\//, '')];
|
||||||
if (['js/jquery.js', 'plugins/ep_etherpad-lite/static/js/jquery.js'].indexOf(filename) !== -1) {
|
if (newLocation != null) {
|
||||||
logger.warn(`request for deprecated jQuery path: ${filename}`);
|
logger.warn(`request for deprecated path "${filename}", replacing with "${newLocation}"`);
|
||||||
filename = 'js/vendors/jquery.js';
|
filename = newLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle static files for plugins/libraries:
|
/* Handle static files for plugins/libraries:
|
||||||
|
|
Loading…
Reference in a new issue