Improved: Bundles detection

This commit is contained in:
nobody 2020-11-09 19:42:09 +01:00
parent e5df85fadb
commit 965dfaa1da
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 10 additions and 9 deletions

View File

@ -155,7 +155,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
}
// Get bundle name
let bundle = targets.determineBundle(channelPath);
let bundle = targets.determineBundle(targetPath);
if (bundle !== '') {
filename = channelPath.split('/').pop();
targetPath = ( RegExp('.*\.css$').test(filename) ) ? targetPath + filename : targetPath + filename + 'm';

View File

@ -24,20 +24,21 @@ var targets = {};
* Public Methods
*/
targets.determineBundle = function (path = '') {
if (path.includes('findify')) {
targets.determineBundle = function (path) {
path = path.replace('resources', '');
if (path.startsWith('/findify')) {
return 'Findify';
} else if (path.includes('bootstrap-datepicker')) {
} else if (path.startsWith('/bootstrap-datepicker')) {
return 'Bootstrap Datepicker';
} else if (path.includes('/jquery.lazy/')) {
} else if (path.startsWith('/jquery.lazy/')) {
return 'jQuery Lazy';
} else if (path.includes('/waypoints/')) {
} else if (path.startsWith('/waypoints/')) {
return 'Waypoints';
} else if (path.includes('/highlight.js/')) {
} else if (path.startsWith('/highlight.js/')) {
return 'highlight.js';
} else if (path.includes('/element-ui/')) {
} else if (path.startsWith('/element-ui/')) {
return 'ElementUI';
} else if (path.includes('/select2/')) {
} else if (path.startsWith('/select2/')) {
return 'Select2';
} else {
return '';