1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-12 13:48:33 +09:00
misskey/webpack/module/rules/base64.ts
2018-02-15 23:07:23 +09:00

19 lines
337 B
TypeScript

/**
* Replace base64 symbols
*/
import * as fs from 'fs';
export default () => ({
enforce: 'pre',
test: /\.(vue|js)$/,
exclude: /node_modules/,
loader: 'string-replace-loader',
query: {
search: /%base64:(.+?)%/g,
replace: (_, key) => {
return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64');
}
}
});