This commit is contained in:
syuilo 2018-01-01 02:08:41 +09:00
parent 727ecf86b9
commit 88e4f1b287
5 changed files with 24 additions and 7 deletions

View file

@ -0,0 +1,13 @@
import * as fs from 'fs';
const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8');
const licenseHtml = license
.replace(/\r\n/g, '\n')
.replace(/(.)\n(.)/g, '$1 $2')
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
export {
license,
licenseHtml
};

View file

@ -0,0 +1,3 @@
h1 License
div!= common.license

View file

@ -0,0 +1,3 @@
h1 ライセンス
div!= common.license

View file

@ -4,6 +4,7 @@ import * as yaml from 'js-yaml';
import { fa } from '../../common/build/fa';
import config from '../../conf';
import { licenseHtml } from '../../common/build/license';
const constants = require('../../const.json');
export default function(): { [key: string]: any } {
@ -42,5 +43,7 @@ export default function(): { [key: string]: any } {
vars['facss'] = fa.dom.css();
vars['license'] = licenseHtml;
return vars;
}

View file

@ -2,13 +2,8 @@
* 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>');
import { licenseHtml } from '../../../src/common/build/license';
export default () => ({
enforce: 'pre',
@ -16,7 +11,7 @@ export default () => ({
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [{
pattern: '%license%', replacement: () => license
pattern: '%license%', replacement: () => licenseHtml
}]
})
});