mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(tools/gulp): add html minifying task to generated docs (#3476)
This commit is contained in:
committed by
tinayuangao
parent
ee853b9f6c
commit
cdb3763be7
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user