summaryrefslogtreecommitdiff
path: root/webpack
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-22 05:05:19 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-22 05:05:19 +0900
commit0df6f5a2535374ddaed3daad586872574bb4b283 (patch)
tree2c6e46d0b73f82ec89cace9a752f4fff78e37699 /webpack
parentwip (diff)
downloadsharkey-0df6f5a2535374ddaed3daad586872574bb4b283.tar.gz
sharkey-0df6f5a2535374ddaed3daad586872574bb4b283.tar.bz2
sharkey-0df6f5a2535374ddaed3daad586872574bb4b283.zip
wip
Diffstat (limited to 'webpack')
-rw-r--r--webpack/module/rules/base64.ts18
-rw-r--r--webpack/webpack.config.ts13
2 files changed, 12 insertions, 19 deletions
diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts
deleted file mode 100644
index c2f6b9339e..0000000000
--- a/webpack/module/rules/base64.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * 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');
- }
- }
-});
diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts
index bd8c6d1205..76d2980788 100644
--- a/webpack/webpack.config.ts
+++ b/webpack/webpack.config.ts
@@ -2,6 +2,7 @@
* webpack configuration
*/
+import * as fs from 'fs';
const minify = require('html-minifier').minify;
import I18nReplacer from '../src/common/build/i18n';
import { pattern as faPattern, replacement as faReplacement } from '../src/common/build/fa';
@@ -19,7 +20,11 @@ global['collapseSpacesReplacement'] = html => {
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
keepClosingSlash: true
- });
+ }).replace(/\t/g, '');
+};
+
+global['base64replacement'] = (_, key) => {
+ return fs.readFileSync(__dirname + '/../src/web/' + key, 'base64');
};
module.exports = Object.keys(langs).map(lang => {
@@ -60,6 +65,12 @@ module.exports = Object.keys(langs).map(lang => {
preserveWhitespace: false
}
}, {
+ loader: 'replace',
+ query: {
+ search: /%base64:(.+?)%/g.toString(),
+ replace: 'base64replacement'
+ }
+ }, {
loader: 'webpack-replace-loader',
options: {
search: '$theme-color',