mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:43:07 +02:00
wip
This commit is contained in:
parent
085ac938c2
commit
11f32375b6
10 changed files with 70 additions and 122 deletions
|
@ -37,7 +37,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import Sortable from 'sortablejs';
|
||||
import * as Sortable from 'sortablejs';
|
||||
import Autocomplete from '../../scripts/autocomplete';
|
||||
import getKao from '../../../common/scripts/get-kao';
|
||||
import notify from '../../scripts/notify';
|
||||
|
|
|
@ -7,9 +7,11 @@ function trim(text) {
|
|||
module.exports = function(src) {
|
||||
this.cacheable();
|
||||
const options = loaderUtils.getOptions(this);
|
||||
if (typeof options.search != 'string' || options.search.length == 0) console.error('invalid search');
|
||||
if (typeof options.replace != 'function') console.error('invalid replacer');
|
||||
src = src.replace(new RegExp(trim(options.search), 'g'), options.replace);
|
||||
const search = options.search;
|
||||
const replace = global[options.replace];
|
||||
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
||||
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
||||
src = src.replace(new RegExp(trim(search), 'g'), replace);
|
||||
this.callback(null, src);
|
||||
return src;
|
||||
};
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import rules from './rules';
|
||||
|
||||
export default lang => ({
|
||||
rules: rules(lang)
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* Replace fontawesome symbols
|
||||
*/
|
||||
|
||||
import { pattern, replacement } from '../../../src/common/build/fa';
|
||||
|
||||
export default () => ({
|
||||
//enforce: 'pre',
|
||||
test: /\.(vue|js|ts)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: pattern.toString(),
|
||||
replace: replacement
|
||||
}
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Replace i18n texts
|
||||
*/
|
||||
|
||||
import Replacer from '../../../src/common/build/i18n';
|
||||
|
||||
export default lang => {
|
||||
const replacer = new Replacer(lang);
|
||||
|
||||
return {
|
||||
//enforce: 'post',
|
||||
test: /\.(vue|js|ts)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: replacer.pattern.toString(),
|
||||
replace: replacer.replacement
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
import i18n from './i18n';
|
||||
import fa from './fa';
|
||||
//import base64 from './base64';
|
||||
import vue from './vue';
|
||||
import stylus from './stylus';
|
||||
import typescript from './typescript';
|
||||
import collapseSpaces from './collapse-spaces';
|
||||
|
||||
export default lang => [
|
||||
//collapseSpaces(),
|
||||
|
||||
//base64(),
|
||||
vue(),
|
||||
i18n(lang),
|
||||
fa(),
|
||||
stylus(),
|
||||
typescript()
|
||||
];
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* Stylus support
|
||||
*/
|
||||
|
||||
export default () => ({
|
||||
test: /\.styl$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{ loader: 'style-loader' },
|
||||
{ loader: 'css-loader' },
|
||||
{ loader: 'stylus-loader' }
|
||||
]
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* TypeScript
|
||||
*/
|
||||
|
||||
export default () => ({
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: __dirname + '/../../../src/web/app/tsconfig.json',
|
||||
appendTsSuffixTo: [/\.vue$/]
|
||||
}
|
||||
});
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* Vue
|
||||
*/
|
||||
|
||||
const constants = require('../../../src/const.json');
|
||||
|
||||
export default () => ({
|
||||
test: /\.vue$/,
|
||||
exclude: /node_modules/,
|
||||
use: [{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
cssSourceMap: false,
|
||||
preserveWhitespace: false
|
||||
}
|
||||
}, {
|
||||
loader: 'webpack-replace-loader',
|
||||
options: {
|
||||
search: '$theme-color',
|
||||
replace: constants.themeColor,
|
||||
attr: 'g'
|
||||
}
|
||||
}, {
|
||||
loader: 'webpack-replace-loader',
|
||||
query: {
|
||||
search: '$theme-color-foreground',
|
||||
replace: constants.themeColorForeground,
|
||||
attr: 'g'
|
||||
}
|
||||
}]
|
||||
});
|
|
@ -2,12 +2,17 @@
|
|||
* webpack configuration
|
||||
*/
|
||||
|
||||
import module_ from './module';
|
||||
import I18nReplacer from '../src/common/build/i18n';
|
||||
import { pattern as faPattern, replacement as faReplacement } from '../src/common/build/fa';
|
||||
const constants = require('../src/const.json');
|
||||
|
||||
import plugins from './plugins';
|
||||
|
||||
import langs from '../locales';
|
||||
import version from '../src/version';
|
||||
|
||||
global['faReplacement'] = faReplacement;
|
||||
|
||||
module.exports = Object.keys(langs).map(lang => {
|
||||
// Chunk name
|
||||
const name = lang;
|
||||
|
@ -29,10 +34,67 @@ module.exports = Object.keys(langs).map(lang => {
|
|||
filename: `[name].${version}.${lang}.js`
|
||||
};
|
||||
|
||||
const i18nReplacer = new I18nReplacer(lang);
|
||||
global['i18nReplacement'] = i18nReplacer.replacement;
|
||||
|
||||
return {
|
||||
name,
|
||||
entry,
|
||||
module: module_(lang),
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.vue$/,
|
||||
exclude: /node_modules/,
|
||||
use: [{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
cssSourceMap: false,
|
||||
preserveWhitespace: false
|
||||
}
|
||||
}, {
|
||||
loader: 'webpack-replace-loader',
|
||||
options: {
|
||||
search: '$theme-color',
|
||||
replace: constants.themeColor,
|
||||
attr: 'g'
|
||||
}
|
||||
}, {
|
||||
loader: 'webpack-replace-loader',
|
||||
query: {
|
||||
search: '$theme-color-foreground',
|
||||
replace: constants.themeColorForeground,
|
||||
attr: 'g'
|
||||
}
|
||||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: i18nReplacer.pattern.toString(),
|
||||
replace: 'i18nReplacement'
|
||||
}
|
||||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: faPattern.toString(),
|
||||
replace: 'faReplacement'
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
test: /\.styl$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{ loader: 'style-loader' },
|
||||
{ loader: 'css-loader' },
|
||||
{ loader: 'stylus-loader' }
|
||||
]
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: __dirname + '/../src/web/app/tsconfig.json',
|
||||
appendTsSuffixTo: [/\.vue$/]
|
||||
}
|
||||
}]
|
||||
},
|
||||
plugins: plugins(version, lang),
|
||||
output,
|
||||
resolve: {
|
||||
|
|
Loading…
Reference in a new issue