✌️
This commit is contained in:
parent
f849dcb7b9
commit
845dc26184
5 changed files with 36 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
import i18n from './i18n';
|
||||
import license from './license';
|
||||
import fa from './fa';
|
||||
import base64 from './base64';
|
||||
import themeColor from './theme-color';
|
||||
|
@ -8,6 +9,7 @@ import typescript from './typescript';
|
|||
|
||||
export default (lang, locale) => [
|
||||
i18n(lang, locale),
|
||||
license(),
|
||||
fa(),
|
||||
base64(),
|
||||
themeColor(),
|
||||
|
|
22
webpack/module/rules/license.ts
Normal file
22
webpack/module/rules/license.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Inject license
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
|
||||
const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8')
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/(.)\n(.)/g, '$1 $2')
|
||||
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
||||
|
||||
export default () => ({
|
||||
enforce: 'pre',
|
||||
test: /\.(tag|js)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: StringReplacePlugin.replace({
|
||||
replacements: [{
|
||||
pattern: '%license%', replacement: () => license
|
||||
}]
|
||||
})
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue