mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-16 20:00:57 +01:00
Improved: Font Awesome (Fonts only) (#170)
This commit is contained in:
parent
c47b926d30
commit
7edb451d17
@ -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 = {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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}/',
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 '';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user