0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gulpを使って変更したファイルだけをコピーする

Posted at

更新したファイルだけ取得したい、という状況になり、勉強がてらgulpで書いてみました。
ただこれだと、追加したファイルが対応出来ないんですよねえ。

gulp.js
var gulp = require("gulp"),
    changed = require("gulp-changed");

paths = {
    src: "./src/**/*.+(php|js|css)",
    dest: "./dest",
    deploy: "./deploy"
}

gulp.task("deploy", function() {
    gulp.src(paths.src)
        .pipe(gulp.dest(paths.deploy));
});

gulp.task("copy", function() {
    gulp.src(paths.src)
        .pipe(changed(paths.deploy))
        .pipe(gulp.dest(paths.deploy))
        .pipe(gulp.dest(paths.dest));
});

gulp.task("watch", function() {
    gulp.watch(paths.src, ['copy']);
});

gulp.task("default", function() {
    gulp.start("deploy");
    gulp.start("watch");
});
0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?