本文整理汇总了TypeScript中gulp-transform.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: src
task('markdown-docs', () => {
// Extend the renderer for custom heading anchor rendering
markdown.marked.Renderer.prototype.heading = (text: string, level: number): string => {
if (level === 3 || level === 4) {
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return `
<h${level} id="${escapedText}" class="docs-header-link">
<div header-link="${escapedText}"></div>
${text}
</h${level}>
`;
} else {
return `<h${level}>${text}</h${level}>`;
}
};
return src(['src/lib/**/*.md', 'src/cdk/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string): string => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform(transformMarkdownFiles))
.pipe(dom(createTagNameAliaser('docs-markdown')))
.pipe(dest('dist/docs/markdown'));
});
示例2:
gulp.task('docs', () => {
return gulp.src(['src/lib/**/*.md'])
.pipe(markdown())
.pipe(transform((content: string) =>
content.toString().replace(EXAMPLE_PATTERN, (match: string, name: string) =>
`<div material-docs-example="${name}"></div>`)))
.pipe(gulp.dest('dist/docs'));
});
示例3: src
task('markdown-docs-cdk', () => {
return src(['src/cdk/**/!(README).md'])
.pipe(rename({prefix: 'cdk-'}))
.pipe(markdown(markdownOptions))
.pipe(transform(transformMarkdownFiles))
.pipe(dom(createTagNameAliaser('docs-markdown')))
.pipe(dest('dist/docs/markdown'));
});
示例4:
gulp.task('markdown-docs', () => {
return gulp.src(['src/lib/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string) => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform(transformMarkdownFiles))
.pipe(gulp.dest('dist/docs/markdown'));
});
示例5:
gulp.task('docs', () => {
return gulp.src(['src/lib/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string) => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform((content: string) =>
content.toString().replace(EXAMPLE_PATTERN, (match: string, name: string) =>
`<div material-docs-example="${name}"></div>`)))
.pipe(gulp.dest('dist/docs'));
});