我创建了一个熟悉构建工具的项目。我的这个项目的文件夹结构如下:
+ my-project
|-- + sources
|------ index.html
|-- + www
|-- gulpfile.js
glupfile.js
的内容是:
var gulp = require('gulp');
gulp.task('default', function() {
gulp.src('sources/index.html')
.pipe(gulp.dest('www/index.html'));
});
为简单起见,我chmod
将此文件夹(以及所有父文件夹)中的所有内容都添加到777
- 因此不存在文件权限问题。
然而,当我运行gulp
时,我得到以下输出:
user@server:~/my-project# gulp
[00:05:09] Using gulpfile ~/my-project/gulpfile.js
[00:05:09] Starting 'default'...
[00:05:09] Finished 'default' after 11 ms
并且绝对没有创建任何文件。 <{1}}文件夹仍然是贫瘠的。
我做错了什么?
答案 0 :(得分:3)
省略index.html。您应始终将文件传输到文件夹(desc)而不是另一个文件(index.html)
var gulp = require('gulp');
gulp.task('default', function() {
gulp.src('sources/index.html')
.pipe(gulp.dest('www'));
});