【问题标题】:Gulp not creating any filesGulp 不创建任何文件
【发布时间】:2015-11-15 05:11:11
【问题描述】:

我创建了一个项目来熟悉构建工具。我的这个项目的文件夹结构如下:

+ 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'd 将此文件夹(以及所有父文件夹)中的所有内容都添加到 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

绝对不会创建任何文件。 www 文件夹仍然是空的。

我做错了什么?

【问题讨论】:

    标签: build automation gulp build-tools


    【解决方案1】:

    省略 index.html。您应该始终将文件通过管道传输到文件夹(desc)而不是另一个文件(index.html)

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

    【讨论】:

      猜你喜欢
      • 2020-12-21
      • 1970-01-01
      • 2019-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-09
      • 1970-01-01
      相关资源
      最近更新 更多