gpt4 book ai didi

gulp - gulp 任务的第二个参数是什么意思 :

转载 作者:行者123 更新时间:2023-12-04 23:41:18 27 4
gpt4 key购买 nike

我正在寻找答案,不必深入或详细。只是想确切地知道任务序列发生了什么。

gulp.task('name',['*this right here*'], function() {
// content
});

是不是意味着用这个定义任务连续做这个任务?为什么会出现这种情况是因为在我的 gulpfile.js 中我使用了 gulp-inject用于应用程序文件和 wiredep对于供应商依赖项。如果这是错误的,或者任何一个都可以,那就太好了,但我的印象不是。到目前为止我所拥有的如下。
//originally i didn't have bower here in the array in 2nd param.
gulp.task('index', ['bower'], function() {
var target = gulp.src(files.app_files.target);
var sources = gulp.src(files.app_files.sources, {
read: false
});

return target.pipe(inject(sources))
.pipe(gulp.dest('./dist'));
});


gulp.task('bower', function() {
return gulp
.src(files.app_files.target)
.pipe(wiredep())
.pipe(gulp.dest('dist/'));
});


<head>
<meta charset="UTF-8">
<title>Example Page</title>
<!-- Vendor Files -->
<!-- bower:css -->
<!-- endbower -->
<!-- App Files -->
<!-- inject:css -->
<!-- endinject -->
</head>

<body>
<navigation></navigation>
<div ui-view></div>
<footer-area></footer-area>
<!-- Vendor Files -->
<!-- bower:js -->
<!-- endbower -->
<!-- App Files -->
<!-- inject:js -->
<!-- endinject -->
</body>

更新
gulp.task('index', function() {
var target = gulp.src(files.app_files.target);
// It's not necessary to read the files (will speed up things), we're only after their paths:
var sources = gulp.src(files.app_files.sources, {
read: false
});

return target
//here instead of breaking into new task i piped inject and wiredep, works great
.pipe(inject(sources))
.pipe(wiredep())
.pipe(gulp.dest('./dist'));
});

最佳答案

这是在您的任务之前要运行的一系列任务。
另外,请注意这些任务(数组中的所有任务,在您的情况下只有 bower )并行运行。

如果你需要一些顺序。考虑 gulp-sequence

关于gulp - gulp 任务的第二个参数是什么意思 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37082539/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com