wip
This commit is contained in:
parent
a2f4ed0f09
commit
554570cb09
96 changed files with 398 additions and 384 deletions
|
@ -9,7 +9,10 @@ module.exports = function(src) {
|
|||
const options = loaderUtils.getOptions(this);
|
||||
const search = options.search;
|
||||
const g = search[search.length - 1] == 'g';
|
||||
const replace = global[options.replace];
|
||||
const file = this.resourcePath.replace(/\\/g, '/');
|
||||
const replace = global[options.replace].bind(null, {
|
||||
src: file
|
||||
});
|
||||
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
||||
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
||||
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue