1- import gulp = require( 'gulp' ) ;
1+ import { task , src , dest } from 'gulp' ;
2+ import { Dgeni } from 'dgeni' ;
3+ import * as path from 'path' ;
4+
5+ // Node packages that lack of types.
26const markdown = require ( 'gulp-markdown' ) ;
37const transform = require ( 'gulp-transform' ) ;
48const highlight = require ( 'gulp-highlight-files' ) ;
59const rename = require ( 'gulp-rename' ) ;
610const flatten = require ( 'gulp-flatten' ) ;
711const hljs = require ( 'highlight.js' ) ;
8- import { task } from 'gulp' ;
9- import * as path from 'path' ;
1012
1113// Our docs contain comments of the form `<!-- example(...) -->` which serve as placeholders where
1214// example code should be inserted. We replace these comments with divs that have a
@@ -19,10 +21,10 @@ const EXAMPLE_PATTERN = /<!--\W*example\(([^)]+)\)\W*-->/g;
1921// documentation page. Using a RegExp to rewrite links in HTML files to work in the docs.
2022const LINK_PATTERN = / ( < a [ ^ > ] * ) h r e f = " ( [ ^ " ] * ) " / g;
2123
22- gulp . task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' ] )
24+ task ( 'docs' , [ 'markdown-docs' , 'highlight-docs' , 'api-docs' ] ) ;
2325
24- gulp . task ( 'markdown-docs' , ( ) => {
25- return gulp . src ( [ 'src/lib/**/*.md' , 'guides/*.md' ] )
26+ task ( 'markdown-docs' , ( ) => {
27+ return src ( [ 'src/lib/**/*.md' , 'guides/*.md' ] )
2628 . pipe ( markdown ( {
2729 // Add syntax highlight using highlight.js
2830 highlight : ( code : string , language : string ) => {
@@ -36,28 +38,27 @@ gulp.task('markdown-docs', () => {
3638 }
3739 } ) )
3840 . pipe ( transform ( transformMarkdownFiles ) )
39- . pipe ( gulp . dest ( 'dist/docs/markdown' ) ) ;
41+ . pipe ( dest ( 'dist/docs/markdown' ) ) ;
4042} ) ;
4143
42- gulp . task ( 'highlight-docs' , ( ) => {
44+ task ( 'highlight-docs' , ( ) => {
4345 // rename files to fit format: [filename]-[filetype].html
4446 const renameFile = ( path : any ) => {
4547 const extension = path . extname . slice ( 1 ) ;
4648 path . basename = `${ path . basename } -${ extension } ` ;
4749 } ;
4850
49- return gulp . src ( 'src/examples/**/*.+(html|css|ts)' )
51+ return src ( 'src/examples/**/*.+(html|css|ts)' )
5052 . pipe ( flatten ( ) )
5153 . pipe ( rename ( renameFile ) )
5254 . pipe ( highlight ( ) )
53- . pipe ( gulp . dest ( 'dist/docs/examples' ) ) ;
55+ . pipe ( dest ( 'dist/docs/examples' ) ) ;
5456} ) ;
5557
5658task ( 'api-docs' , ( ) => {
57- const Dgeni = require ( 'dgeni' ) ;
5859 const docsPackage = require ( path . resolve ( __dirname , '../../dgeni' ) ) ;
59- const dgeni = new Dgeni ( [ docsPackage ] ) ;
60- return dgeni . generate ( ) ;
60+ const docs = new Dgeni ( [ docsPackage ] ) ;
61+ return docs . generate ( ) ;
6162} ) ;
6263
6364/** Updates the markdown file's content to work inside of the docs app. */
0 commit comments