diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2016-12-29 16:08:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2016-12-29 16:08:34 +0900 |
| commit | b87e6e80446f32666c5ea8203cda8ab6051215f8 (patch) | |
| tree | e45320da1c9d0e914592c58cf4f87e6c5dd3da90 /gulpfile.ts | |
| parent | :art: (diff) | |
| download | sharkey-b87e6e80446f32666c5ea8203cda8ab6051215f8.tar.gz sharkey-b87e6e80446f32666c5ea8203cda8ab6051215f8.tar.bz2 sharkey-b87e6e80446f32666c5ea8203cda8ab6051215f8.zip | |
:hammer:
Diffstat (limited to 'gulpfile.ts')
| -rw-r--r-- | gulpfile.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gulpfile.ts b/gulpfile.ts index 4ac2f5a820..2bc948296f 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -24,6 +24,7 @@ const transformify = require('syuilo-transformify'); const pug = require('gulp-pug'); const git = require('git-last-commit'); import * as rimraf from 'rimraf'; +import * as escapeHtml from 'escape-html'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; @@ -63,11 +64,16 @@ gulp.task('build:ts', () => .pipe(gulp.dest('./built/')) ); -gulp.task('build:about:docs', () => { - const licenseHtml = fs.readFileSync('./LICENSE', 'utf-8') +function getLicenseHtml(path: string): string { + return escapeHtml(fs.readFileSync(path, 'utf-8')) .replace(/\r\n/g, '\n') .replace(/(.)\n(.)/g, '$1 $2') .replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>'); +} + +gulp.task('build:about:docs', () => { + const licenses = glob.sync('./node_modules/**/LICENSE*'); + const licenseHtml = [getLicenseHtml('./LICENSE')].concat(licenses.map(license => getLicenseHtml(license))).join('<hr>'); const pugs = glob.sync('./src/web/about/pages/**/*.pug'); const streams = pugs.map(file => { const page = file.replace('./src/web/about/pages/', '').replace('.pug', ''); |