From 5f40e7eaa46fd8a3f60d2306a21364e38db73012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=B4=E3=81=AA=E3=81=9F=E3=81=BF=E3=81=BD?= Date: Sun, 22 Oct 2017 14:11:28 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AA=E3=83=95=E3=83=A9=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=81=A7=E3=82=82=E7=94=BB=E5=83=8F=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=ABbase64?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=A6=E5=9F=8B=E3=82=81=E8=BE=BC=E3=82=80?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/common/tags/error.tag | 2 +- webpack/module/rules/base64.ts | 19 +++++++++++++++++++ webpack/module/rules/index.ts | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/base64.ts diff --git a/src/web/app/common/tags/error.tag b/src/web/app/common/tags/error.tag index e4e0272a49..a06f17cd1c 100644 --- a/src/web/app/common/tags/error.tag +++ b/src/web/app/common/tags/error.tag @@ -1,5 +1,5 @@ - +

%i18n:common.tags.mk-error.title%

%i18n:common.tags.mk-error.description%

%i18n:common.tags.mk-error.thanks%

diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts new file mode 100644 index 0000000000..529816bd20 --- /dev/null +++ b/webpack/module/rules/base64.ts @@ -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'); + } + }] + }) +}); diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 2707a9c2f1..9c1262b3d6 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -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(),