@@ -8,6 +8,7 @@ const transform = require('gulp-transform');
88const highlight = require ( 'gulp-highlight-files' ) ;
99const rename = require ( 'gulp-rename' ) ;
1010const flatten = require ( 'gulp-flatten' ) ;
11+ const htmlmin = require ( 'gulp-htmlmin' ) ;
1112const hljs = require ( 'highlight.js' ) ;
1213
1314// Our docs contain comments of the form `<!-- example(...) -->` which serve as placeholders where
@@ -21,7 +22,7 @@ const EXAMPLE_PATTERN = /<!--\W*example\(([^)]+)\)\W*-->/g;
2122// documentation page. Using a RegExp to rewrite links in HTML files to work in the docs.
2223const LINK_PATTERN = / ( < a [ ^ > ] * ) h r e f = " ( [ ^ " ] * ) " / g;
2324
24- task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' ] ) ;
25+ task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' , 'minify-html-docs' ] ) ;
2526
2627task ( 'markdown-docs' , ( ) => {
2728 return src ( [ 'src/lib/**/*.md' , 'guides/*.md' ] )
@@ -61,6 +62,12 @@ task('api-docs', () => {
6162 return docs . generate ( ) ;
6263} ) ;
6364
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+
6471/** Updates the markdown file's content to work inside of the docs app. */
6572function transformMarkdownFiles ( buffer : Buffer , file : any ) : string {
6673 let content = buffer . toString ( 'utf-8' ) ;
0 commit comments