chore(tools/gulp): add html minifying task to generated docs (#3476)

This commit is contained in:
Raven Avalon
2017-03-10 14:44:18 -05:00
committed by tinayuangao
parent ee853b9f6c
commit cdb3763be7
+9 -1
View File
@@ -1,6 +1,7 @@
import {task, src, dest} from 'gulp';
import {Dgeni} from 'dgeni';
import * as path from 'path';
import {HTML_MINIFIER_OPTIONS} from '../constants';
// Node packages that lack of types.
const markdown = require('gulp-markdown');
@@ -8,6 +9,7 @@ const transform = require('gulp-transform');
const highlight = require('gulp-highlight-files');
const rename = require('gulp-rename');
const flatten = require('gulp-flatten');
const htmlmin = require('gulp-htmlmin');
const hljs = require('highlight.js');
const dom = require('gulp-dom');
@@ -42,7 +44,7 @@ const MARKDOWN_TAGS_TO_CLASS_ALIAS = [
'ul'
];
task('docs', ['markdown-docs', 'highlight-docs', 'api-docs']);
task('docs', ['markdown-docs', 'highlight-docs', 'api-docs', 'minify-html-docs']);
task('markdown-docs', () => {
return src(['src/lib/**/*.md', 'guides/*.md'])
@@ -83,6 +85,12 @@ task('api-docs', () => {
return docs.generate();
});
task('minify-html-docs', ['api-docs'], () => {
return src('dist/docs/api/*.html')
.pipe(htmlmin(HTML_MINIFIER_OPTIONS))
.pipe(dest('dist/docs/api/'));
});
/** Updates the markdown file's content to work inside of the docs app. */
function transformMarkdownFiles(buffer: Buffer, file: any): string {
let content = buffer.toString('utf-8');