mirror of
https://github.com/sim1222/misskey.git
synced 2025-07-01 16:29:56 +09:00
オフラインでも画像を表示できるようにbase64にして埋め込むようにした
This commit is contained in:
19
webpack/module/rules/base64.ts
Normal file
19
webpack/module/rules/base64.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Replace base64 symbols
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
|
||||
export default () => ({
|
||||
enforce: 'pre',
|
||||
test: /\.(tag|js)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: StringReplacePlugin.replace({
|
||||
replacements: [{
|
||||
pattern: /%base64:(.+?)%/g, replacement: (_, key) => {
|
||||
return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64');
|
||||
}
|
||||
}]
|
||||
})
|
||||
});
|
Reference in New Issue
Block a user