我使用Gulp 4创建了一个项目。一切都进行得很详细。我想将我的js设置代码放置在Node Modules中,但不会发生
var gulp = require("gulp"),
sass = require("gulp-sass"),
browserSync = require("browser-sync").create();
var paths = {
styles: {
src:"./*.html",
src: "./scss/*.scss",
dest: "./css",
}
};
function style() {
return gulp
.src(paths.styles.src)
.pipe(sass())
.on("error", sass.logError)
.pipe(gulp.dest(paths.styles.dest))
.pipe(browserSync.stream(reload));
}
function reload() {
browserSync.reload();
}
function watch() {
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch(paths.styles.src, style);
gulp.watch("./*.html").on('change', browserSync.reload);
}
exports.watch = watch
exports.style = style;
var build = gulp.parallel(style, watch);
gulp.task('default', build);
我无法在上述代码中运行以下代码
function modules () {
// Bootstrap
var bootstrap = gulp.src ('./ node_modules / bootstrap / dist / ** / *')
.pip A (gulp.dest ( './ Vendor / bootstrap'));
// jQuery
var jquery = gulp.src ([
'./Node_modules/jquery/dist/*'
'! ./ node_modules / jQuery / dist / core.js'
])
.pip A (gulp.dest ( './ Vendor / jquery'));
return merge (bootstrap, jquery);
}