mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
オフラインでも画像を表示できるようにbase64にして埋め込むようにした
This commit is contained in:
parent
b11a789725
commit
323d256194
@ -1,5 +1,5 @@
|
||||
<mk-error>
|
||||
<img src="/assets/error.jpg" alt=""/>
|
||||
<img src="data:image/jpeg;base64,%base64:/assets/error.jpg%" alt=""/>
|
||||
<h1>%i18n:common.tags.mk-error.title%</h1>
|
||||
<p class="text">%i18n:common.tags.mk-error.description%</p>
|
||||
<p class="thanks">%i18n:common.tags.mk-error.thanks%</p>
|
||||
|
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');
|
||||
}
|
||||
}]
|
||||
})
|
||||
});
|
@ -1,4 +1,5 @@
|
||||
import i18n from './i18n';
|
||||
import base64 from './base64';
|
||||
import themeColor from './theme-color';
|
||||
import tag from './tag';
|
||||
import stylus from './stylus';
|
||||
@ -6,6 +7,7 @@ import typescript from './typescript';
|
||||
|
||||
export default (lang, locale) => [
|
||||
i18n(lang, locale),
|
||||
base64(),
|
||||
themeColor(),
|
||||
tag(),
|
||||
stylus(),
|
||||
|
Loading…
Reference in New Issue
Block a user