@@ -8,6 +8,7 @@ const transform = require('gulp-transform');
8
8
const highlight = require ( 'gulp-highlight-files' ) ;
9
9
const rename = require ( 'gulp-rename' ) ;
10
10
const flatten = require ( 'gulp-flatten' ) ;
11
+ const htmlmin = require ( 'gulp-htmlmin' ) ;
11
12
const hljs = require ( 'highlight.js' ) ;
12
13
13
14
// Our docs contain comments of the form `<!-- example(...) -->` which serve as placeholders where
@@ -21,7 +22,7 @@ const EXAMPLE_PATTERN = /<!--\W*example\(([^)]+)\)\W*-->/g;
21
22
// documentation page. Using a RegExp to rewrite links in HTML files to work in the docs.
22
23
const LINK_PATTERN = / ( < a [ ^ > ] * ) h r e f = " ( [ ^ " ] * ) " / g;
23
24
24
- task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' ] ) ;
25
+ gulp . task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' , 'minify-html -docs'] ) ;
25
26
26
27
task ( 'markdown-docs' , ( ) => {
27
28
return src ( [ 'src/lib/**/*.md' , 'guides/*.md' ] )
@@ -61,6 +62,12 @@ task('api-docs', () => {
61
62
return docs . generate ( ) ;
62
63
} ) ;
63
64
65
+ task ( 'minify-html-docs' , [ 'api-docs' ] , ( ) => {
66
+ return gulp . src ( 'dist/docs/api/*.html' )
67
+ . pipe ( htmlmin ( { collapseWhitespace : true } ) )
68
+ . pipe ( gulp . dest ( 'dist/docs/api/' ) ) ;
69
+ } ) ;
70
+
64
71
/** Updates the markdown file's content to work inside of the docs app. */
65
72
function transformMarkdownFiles ( buffer : Buffer , file : any ) : string {
66
73
let content = buffer . toString ( 'utf-8' ) ;
0 commit comments