mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 10:23:08 +02:00
wip
This commit is contained in:
parent
a7601f7aa4
commit
085ac938c2
6 changed files with 28 additions and 8 deletions
|
@ -125,6 +125,7 @@
|
|||
"is-url": "1.2.2",
|
||||
"js-yaml": "3.10.0",
|
||||
"license-checker": "16.0.0",
|
||||
"loader-utils": "^1.1.0",
|
||||
"mecab-async": "0.1.2",
|
||||
"mkdirp": "0.5.1",
|
||||
"mocha": "5.0.0",
|
||||
|
|
15
webpack/loaders/replace.js
Normal file
15
webpack/loaders/replace.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const loaderUtils = require('loader-utils');
|
||||
|
||||
function trim(text) {
|
||||
return text.substring(1, text.length - 2);
|
||||
}
|
||||
|
||||
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);
|
||||
this.callback(null, src);
|
||||
return src;
|
||||
};
|
|
@ -5,12 +5,12 @@
|
|||
import { pattern, replacement } from '../../../src/common/build/fa';
|
||||
|
||||
export default () => ({
|
||||
enforce: 'pre',
|
||||
//enforce: 'pre',
|
||||
test: /\.(vue|js|ts)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'string-replace-loader',
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: pattern,
|
||||
search: pattern.toString(),
|
||||
replace: replacement
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,12 +8,12 @@ export default lang => {
|
|||
const replacer = new Replacer(lang);
|
||||
|
||||
return {
|
||||
enforce: 'pre',
|
||||
//enforce: 'post',
|
||||
test: /\.(vue|js|ts)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'string-replace-loader',
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: replacer.pattern,
|
||||
search: replacer.pattern.toString(),
|
||||
replace: replacer.replacement
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,10 +8,11 @@ import collapseSpaces from './collapse-spaces';
|
|||
|
||||
export default lang => [
|
||||
//collapseSpaces(),
|
||||
//i18n(lang),
|
||||
//fa(),
|
||||
|
||||
//base64(),
|
||||
vue(),
|
||||
i18n(lang),
|
||||
fa(),
|
||||
stylus(),
|
||||
typescript()
|
||||
];
|
||||
|
|
|
@ -40,6 +40,9 @@ module.exports = Object.keys(langs).map(lang => {
|
|||
'.js', '.ts'
|
||||
]
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: ['node_modules', './webpack/loaders']
|
||||
},
|
||||
cache: true,
|
||||
devtool: 'eval',
|
||||
stats: true,
|
||||
|
|
Loading…
Reference in a new issue