Improved: Font Awesome (Fonts only) (#170)

This commit is contained in:
nobody 2020-11-10 16:42:28 +01:00
parent c47b926d30
commit 7edb451d17
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
6 changed files with 9 additions and 11 deletions

View File

@ -203,7 +203,7 @@ const Regex = {
'BOOTSTRAP_DATEPICKER': /\/bootstrap-datepicker.*\.css/,
'FONT_AWESOME': /use\.fontawesome\.com\/fa-loader\.css/,
'FONT_AWESOME_WITH_CODE': /use\.fontawesome\.com\/[a-z0-9]{10}\.(js|css)/,
'FONT_AWESOME_ONLY_FONTS': /\/font-awesome\/(?:\d{1,2}\.){1,3}\d{1,2}\/fonts\//
'FONT_AWESOME_FONTS_ONLY': /\/fontawesome\/(?:\d{1,2}\.){1,3}\d{1,2}\/fonts\//
};
const Links = {

View File

@ -817,7 +817,8 @@ mappings.cdn = {
'bootstrap/{version}/js/bootstrap.min.': resources.bootstrapJS,
'bootstrap/{version}/css/bootstrap.min.': resources.bootstrapCSS,
'twitter-bootstrap/{version}/css/bootstrap': resources.bootstrapCSS,
'font-awesome/{version}/css/font-awesome': resources.fontawesome
'font-awesome/{version}/css/font-awesome': resources.fontawesome,
'font-awesome/{version}/fonts/': resources.fontawesomeFontsOnly
}
},
// NetDNA Bootstrap

View File

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

View File

@ -381,6 +381,9 @@ var resources = {
'path': 'resources/fontawesome/{version}/js/all.min.jsm',
'type': 'application/javascript'
},
'fontawesomeFontsOnly': {
'path': 'resources/fontawesome/{version}/fonts/'
},
// GSAP
'gsapBundle': {
'path': 'resources/gsap/{version}/',

View File

@ -165,14 +165,6 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
'path': 'resources/google-charts/loader.jsm',
'bundle': ''
};
} else if (Regex.FONT_AWESOME_ONLY_FONTS.test(channelPath)) {
lastVersion = targets.setLastVersion('/fontawesome/4.');
return {
'source': channelHost,
'versionDelivered': lastVersion,
'path': 'resources/fontawesome/' + lastVersion + '/fonts/' + helpers.extractFilenameFromPath(channelPath),
'bundle': 'Font Awesome (Fonts)'
};
} else {
return false;
}

View File

@ -42,6 +42,8 @@ targets.determineBundle = function (path) {
return 'Select2';
} else if (path.startsWith('/gsap/')) {
return 'GSAP';
} else if (Regex.FONT_AWESOME_FONTS_ONLY.test(path)) {
return 'Font Awesome (Fonts)';
} else {
return '';
}