簡體   English   中英

Gulp Jade和HTML模板

[英]Gulp Jade and HTML templates

我有一個AngularJS項目,它具有現有的HTML模板,並且我也想開始使用Jade模板。 我想為模板創建一個gulp任務,但是我不確定如何跳過HTML文件的Jade步驟。 這是我所擁有的:

gulp.task('templates', function () {
    return gulp.src('./client/views/**/*.{html, jade}')
        .pipe(jade())
        .pipe(htmlmin({
            collapseWhitespace: true,
            removeComments: true
        }))
        .pipe(templateCache({
            root: 'views/',
            module: 'omApp'
        })) 
        .pipe(gulp.dest('./client/dist/scripts/templates'));
});

使用gulp-if

gulp.task('templates', function () {
return gulp.src('./client/views/**/*.{html, jade}')
    .pipe(gulpif(function(file) { 
        return /jade$/.test(file.path); 
    }, jade()))
    ....

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM