wip
This commit is contained in:
parent
1464df57fa
commit
986780a39a
@ -14,7 +14,7 @@ fontawesome.library.add(brands);
|
|||||||
|
|
||||||
export const pattern = /%fa:(.+?)%/g;
|
export const pattern = /%fa:(.+?)%/g;
|
||||||
|
|
||||||
export const replacement = (_, key) => {
|
export const replacement = (match, key) => {
|
||||||
const args = key.split(' ');
|
const args = key.split(' ');
|
||||||
let prefix = 'fas';
|
let prefix = 'fas';
|
||||||
const classes = [];
|
const classes = [];
|
||||||
|
@ -143,7 +143,8 @@ module.exports = entries.map(x => {
|
|||||||
loader: 'replace',
|
loader: 'replace',
|
||||||
query: {
|
query: {
|
||||||
search: i18nReplacer.pattern.toString(),
|
search: i18nReplacer.pattern.toString(),
|
||||||
replace: 'i18nReplacement'
|
replace: 'i18nReplacement',
|
||||||
|
i18n: true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
loader: 'replace',
|
loader: 'replace',
|
||||||
@ -214,7 +215,8 @@ module.exports = entries.map(x => {
|
|||||||
loader: 'replace',
|
loader: 'replace',
|
||||||
query: {
|
query: {
|
||||||
search: i18nReplacer.pattern.toString(),
|
search: i18nReplacer.pattern.toString(),
|
||||||
replace: 'i18nReplacement'
|
replace: 'i18nReplacement',
|
||||||
|
i18n: true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
loader: 'replace',
|
loader: 'replace',
|
||||||
|
@ -10,9 +10,9 @@ module.exports = function(src) {
|
|||||||
const search = options.search;
|
const search = options.search;
|
||||||
const g = search[search.length - 1] == 'g';
|
const g = search[search.length - 1] == 'g';
|
||||||
const file = this.resourcePath.replace(/\\/g, '/');
|
const file = this.resourcePath.replace(/\\/g, '/');
|
||||||
const replace = global[options.replace].bind(null, {
|
const replace = options.i18n ? global[options.replace].bind(null, {
|
||||||
src: file
|
src: file
|
||||||
});
|
}) : global[options.replace];
|
||||||
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
||||||
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
||||||
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
|
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
|
||||||
|
Loading…
Reference in New Issue
Block a user