This commit is contained in:
parent
2588e7ae9e
commit
45cb5cec04
@ -184,7 +184,6 @@
|
||||
"typescript": "2.7.2",
|
||||
"typescript-eslint-parser": "14.0.0",
|
||||
"uglify-es": "3.3.9",
|
||||
"uglifyjs-webpack-plugin": "1.2.3",
|
||||
"url-loader": "1.0.1",
|
||||
"uuid": "3.2.1",
|
||||
"v-animate-css": "0.0.2",
|
||||
|
@ -62,13 +62,17 @@
|
||||
app = isMobile ? 'mobile' : 'desktop';
|
||||
}
|
||||
|
||||
// Script version
|
||||
const ver = localStorage.getItem('v') || VERSION;
|
||||
|
||||
// Whether use raw version script
|
||||
const raw = localStorage.getItem('useRawScript') == 'true';
|
||||
|
||||
// Load an app script
|
||||
// Note: 'async' make it possible to load the script asyncly.
|
||||
// 'defer' make it possible to run the script when the dom loaded.
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('src', `/assets/${app}.${ver}.${lang}.js`);
|
||||
script.setAttribute('src', `/assets/${app}.${ver}.${lang}.${raw ? 'raw' : 'min'}.js`);
|
||||
script.setAttribute('async', 'true');
|
||||
script.setAttribute('defer', 'true');
|
||||
head.appendChild(script);
|
||||
|
@ -160,10 +160,13 @@
|
||||
<section class="other" v-show="page == 'other'">
|
||||
<h1>高度な設定</h1>
|
||||
<mk-switch v-model="debug" text="デバッグモードを有効にする">
|
||||
<span>この設定はアカウントに保存されません。</span>
|
||||
<span>この設定はブラウザに記憶されます。</span>
|
||||
</mk-switch>
|
||||
<mk-switch v-model="enableExperimental" text="実験的機能を有効にする">
|
||||
<span>この設定はアカウントに保存されません。実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります。</span>
|
||||
<span>実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります。この設定はブラウザに記憶されます。</span>
|
||||
</mk-switch>
|
||||
<mk-switch v-model="useRawScript" text="生のスクリプトを読み込む">
|
||||
<span>圧縮されていない「生の」スクリプトを使用します。サイズが大きいため、読み込みに時間がかかる場合があります。この設定はブラウザに記憶されます。</span>
|
||||
</mk-switch>
|
||||
</section>
|
||||
|
||||
@ -214,6 +217,7 @@ export default Vue.extend({
|
||||
lang: localStorage.getItem('lang') || '',
|
||||
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
|
||||
debug: localStorage.getItem('debug') == 'true',
|
||||
useRawScript: localStorage.getItem('useRawScript') == 'true',
|
||||
enableExperimental: localStorage.getItem('enableExperimental') == 'true'
|
||||
};
|
||||
},
|
||||
@ -236,6 +240,9 @@ export default Vue.extend({
|
||||
debug() {
|
||||
localStorage.setItem('debug', this.debug ? 'true' : 'false');
|
||||
},
|
||||
useRawScript() {
|
||||
localStorage.setItem('useRawScript', this.useRawScript ? 'true' : 'false');
|
||||
},
|
||||
enableExperimental() {
|
||||
localStorage.setItem('enableExperimental', this.enableExperimental ? 'true' : 'false');
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ if (yn) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
localStorage.removeItem('v');
|
||||
|
||||
location.reload(true);
|
||||
} else {
|
||||
alert('問題が解決しない場合はサーバー管理者までお問い合せください。');
|
||||
|
@ -6,7 +6,7 @@ import * as fs from 'fs';
|
||||
import * as webpack from 'webpack';
|
||||
import chalk from 'chalk';
|
||||
import jsonImporter from 'node-sass-json-importer';
|
||||
const minify = require('html-minifier').minify;
|
||||
const minifyHtml = require('html-minifier').minify;
|
||||
const WebpackOnBuildPlugin = require('on-build-webpack');
|
||||
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
@ -17,7 +17,7 @@ const constants = require('./src/const.json');
|
||||
import config from './src/conf';
|
||||
import { licenseHtml } from './src/common/build/license';
|
||||
|
||||
import langs from './locales';
|
||||
import locales from './locales';
|
||||
const meta = require('./package.json');
|
||||
const version = meta.version;
|
||||
|
||||
@ -28,7 +28,7 @@ const isProduction = env === 'production';
|
||||
global['faReplacement'] = faReplacement;
|
||||
|
||||
global['collapseSpacesReplacement'] = html => {
|
||||
return minify(html, {
|
||||
return minifyHtml(html, {
|
||||
collapseWhitespace: true,
|
||||
collapseInlineTagWhitespace: true,
|
||||
keepClosingSlash: true
|
||||
@ -40,7 +40,14 @@ global['base64replacement'] = (_, key) => {
|
||||
};
|
||||
//#endregion
|
||||
|
||||
module.exports = Object.keys(langs).map(lang => {
|
||||
const langs = Object.keys(locales);
|
||||
|
||||
let entries = langs.map(l => [l, false]);
|
||||
entries = entries.concat(langs.map(l => [l, true]));
|
||||
|
||||
module.exports = entries.map(x => {
|
||||
const [lang, doMinify] = x;
|
||||
|
||||
// Chunk name
|
||||
const name = lang;
|
||||
|
||||
@ -58,10 +65,10 @@ module.exports = Object.keys(langs).map(lang => {
|
||||
|
||||
const output = {
|
||||
path: __dirname + '/built/web/assets',
|
||||
filename: `[name].${version}.${lang}.js`
|
||||
filename: `[name].${version}.${lang}.${doMinify ? 'min' : 'raw'}.js`
|
||||
};
|
||||
|
||||
const i18nReplacer = new I18nReplacer(lang);
|
||||
const i18nReplacer = new I18nReplacer(lang as string);
|
||||
global['i18nReplacement'] = i18nReplacer.replacement;
|
||||
|
||||
//#region Define consts
|
||||
@ -110,9 +117,8 @@ module.exports = Object.keys(langs).map(lang => {
|
||||
})
|
||||
];
|
||||
|
||||
if (isProduction) {
|
||||
if (doMinify) {
|
||||
plugins.push(new webpack.optimize.ModuleConcatenationPlugin());
|
||||
plugins.push(minify());
|
||||
}
|
||||
|
||||
return {
|
||||
@ -235,6 +241,9 @@ module.exports = Object.keys(langs).map(lang => {
|
||||
modules: ['node_modules', './webpack/loaders']
|
||||
},
|
||||
cache: true,
|
||||
devtool: 'source-map'
|
||||
devtool: 'source-map',
|
||||
optimization: {
|
||||
minimize: doMinify
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user