Gulp 不会创建"dist"文件夹



我有两个不同的项目。两者都具有gulpfile.jspackage.jsonpackage-lock.json。文件夹结构完全相同。

当我开始狼吞虎咽地阅读第一个项目的文件夹时,一切都很顺利:我收到了一个dist文件夹,里面有所有东西。

但当我在第二个尝试时,它没有。dist文件夹就是没有创建。我刚刚收到消息";无法获取/";。

我的项目结构:

project root
#src
fonts
img
js
script.js (empty)
scss
style.scss (empty)
index.html (includes <body> tag)
node_modules
gulpfile.js
package-lock.json
package.json

这是我的第二个项目的gulpfile

let project_folder = "dist";
let source_folder = "#scr";
let path = {
build: {
html: project_folder + "/",
css: project_folder + "/css/",
js: project_folder + "/js/",
img: project_folder + "/img/",
fonts: project_folder + "/fonts/",
},
src: {
html: source_folder + "/*.html",
css: source_folder + "/scss/style.scss",
js: source_folder + "/js/script.js",
img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
fonts: source_folder + "/fonts/*.ttf",
},
watch: {
html: source_folder + "/**/*.html",
css: source_folder + "/scss/**/*.scss",
js: source_folder + "/js/**/*.js",
img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
},
clean: "./" + project_folder + "/"
}
let { src, dest } = require('gulp'),
gulp = require('gulp'),
browsersync = require('browser-sync').create();
function browserSync(params) {
browsersync.init({
server:{
baseDir: "./" + project_folder + "/"
},
port: 3000,
notify: false
})
}
function html() {
return src(path.src.html)
.pipe(dest(path.build.html))
.pipe(browsersync.stream())
}

let build = gulp.series(html);
let watch = gulp.parallel(build, browserSync);
exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;

终端

[10:57:21] Using gulpfile ~YandexDiskWebFunirogulpfile.js
[10:57:21] Starting 'default'...
[10:57:21] Starting 'browserSync'...
[10:57:21] Starting 'html'...
[10:57:21] Finished 'html' after 31 ms
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.31.89:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
--------------------------------------
[Browsersync] Serving files from: ./dist/

你确定吗?

let source_folder = "#scr";

也许"src"?

最新更新