|
1 | 1 | import {task, src, dest} from 'gulp';
|
2 | 2 | import {Dgeni} from 'dgeni';
|
3 | 3 | import * as path from 'path';
|
| 4 | +import {HTML_MINIFIER_OPTIONS} from '../constants'; |
4 | 5 |
|
5 | 6 | // Node packages that lack of types.
|
6 | 7 | const markdown = require('gulp-markdown');
|
7 | 8 | const transform = require('gulp-transform');
|
8 | 9 | const highlight = require('gulp-highlight-files');
|
9 | 10 | const rename = require('gulp-rename');
|
10 | 11 | const flatten = require('gulp-flatten');
|
| 12 | +const htmlmin = require('gulp-htmlmin'); |
11 | 13 | const hljs = require('highlight.js');
|
12 | 14 | const dom = require('gulp-dom');
|
13 | 15 |
|
@@ -42,7 +44,7 @@ const MARKDOWN_TAGS_TO_CLASS_ALIAS = [
|
42 | 44 | 'ul'
|
43 | 45 | ];
|
44 | 46 |
|
45 |
| -task('docs', ['markdown-docs', 'highlight-docs', 'api-docs']); |
| 47 | +task('docs', ['markdown-docs', 'highlight-docs', 'api-docs', 'minify-html-docs']); |
46 | 48 |
|
47 | 49 | task('markdown-docs', () => {
|
48 | 50 | return src(['src/lib/**/*.md', 'guides/*.md'])
|
@@ -83,6 +85,12 @@ task('api-docs', () => {
|
83 | 85 | return docs.generate();
|
84 | 86 | });
|
85 | 87 |
|
| 88 | +task('minify-html-docs', ['api-docs'], () => { |
| 89 | + return src('dist/docs/api/*.html') |
| 90 | + .pipe(htmlmin(HTML_MINIFIER_OPTIONS)) |
| 91 | + .pipe(dest('dist/docs/api/')); |
| 92 | +}); |
| 93 | + |
86 | 94 | /** Updates the markdown file's content to work inside of the docs app. */
|
87 | 95 | function transformMarkdownFiles(buffer: Buffer, file: any): string {
|
88 | 96 | let content = buffer.toString('utf-8');
|
|
0 commit comments