首页 > 解决方案 > 如何使用 gulp 创建 foo-example/index.html 而不是 foo-example.html?

问题描述

gulp用来组装我的网站。默认情况下,npm run build:prod创建一个dist包含所有 HTML 文件的文件夹,它们的存储方式如下:

index.html
foo.html
bar.html

有没有办法将它们存储为:

index.html
foo/index.html
bar/index.html

我认为我gulpfile的这一部分很有用,但dest设置的是目录,而不是整个文件。

return gulp
    .src(["dist/*.html"])
    .pipe(posthtml(plugins))
    .pipe(gulp.dest(paths.dist));

标签: node.jsgulp

解决方案


推荐阅读