@Levon0908

Собираю gulp-сборку по уроку из Youtube. На создании таска JS я встрял. Сам таск написал, отслеживание js файлов повесил. Что тут не так?

Error: File not found with singular glob: C:/Users/levon/Desktop/gulp-start/#src/js/script.js (if this was purpos
at Glob. (C:\Users\levon\Desktop\gulp-start\node_modules\glob-stream\readable.js:84:17)
at Object.onceWrapper (events.js:483:26)

at done (C:\Users\levon\Desktop\gulp-start\node_modules\glob\glob.js:180:14)
at Glob._processSimple2 (C:\Users\levon\Desktop\gulp-start\node_modules\glob\glob.js:686:12)
at C:\Users\levon\Desktop\gulp-start\node_modules\glob\glob.js:674:10
at Glob._stat2 (C:\Users\levon\Desktop\gulp-start\node_modules\glob\glob.js:770:12)
at lstatcb_ (C:\Users\levon\Desktop\gulp-start\node_modules\glob\glob.js:762:12)
[17:57:52] 'default' errored after 106 ms


let project_folder="dist";
let source_folder="#src";

let path = {
build:{
html: project_folder + "/",
css: project_folder + "/css/",
js: project_folder + "/js/",
img: project_folder + "/img/",
},
src: {
html: [source_folder + "/*.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}",
},
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(),
fileinclude = require("gulp-file-include"),
del = require("del"),
scss = require("gulp-sass"),
clean_css = require('gulp-clean-css'),
rename = require("gulp-rename");
uglify = require('gulp-uglify-es').default;

function browserSync(params) {
browsersync.init({
server:{
baseDir: "./" + project_folder + "/"
},
port:3000,
notify:false
})
}

function html(){
return src(path.src.html)
.pipe(fileinclude())
.pipe(dest(path.build.html))
.pipe(browsersync.stream())
}

function js(){
return src(path.src.js)
.pipe(fileinclude())
.pipe(dest(path.build.js))
.pipe(browsersync.stream())
}
function watchFiles(params) {
gulp.watch([path.watch.html], html);
gulp.watch([path.watch.css], css);
gulp.watch([path.watch.js], js);

}

function clean(params) {
return del(path.clean);
}

function css (){
return src(path.src.css)
.pipe(
scss({
outputStyle: "expanded"
})
)
.pipe(dest(path.build.css))
.pipe(clean_css())
.pipe(
rename({
extname: ".min.css"
})
)
.pipe(dest(path.build.css))
.pipe(browsersync.stream())
}

let build = gulp.series(clean, gulp.parallel(js, css, html));
let watch = gulp.parallel(build, watchFiles, browserSync);

exports.js = js
exports.css = css
exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;
  • Вопрос задан
  • 23 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы