This commit is contained in:
syuilo
2018-02-22 05:05:19 +09:00
parent 5daae05bcf
commit 0df6f5a253
6 changed files with 165 additions and 26 deletions

View File

@ -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 => {
@ -59,6 +64,12 @@ module.exports = Object.keys(langs).map(lang => {
cssSourceMap: false,
preserveWhitespace: false
}
}, {
loader: 'replace',
query: {
search: /%base64:(.+?)%/g.toString(),
replace: 'base64replacement'
}
}, {
loader: 'webpack-replace-loader',
options: {