2015-11-15 87 views
1

我创建了一个项目来熟悉构建工具。我对这个项目的文件夹结构看起来像这样:Gulp没有创建任何文件

+ 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,我得到下面的输出:

[email protected]:~/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 

,绝对不会创建任何文件。该www文件夹仍然荒芜。

我在做什么错?

回答

3

离开index.html。您应该始终将文件传输到文件夹(desc)而不是其他文件(index.html)

var gulp = require('gulp'); 

gulp.task('default', function() { 
gulp.src('sources/index.html') 
.pipe(gulp.dest('www')); 
});