javascript - TypeError:cannot read property 'on' of undefined -
i have gulp task read data file , write file.
for doing :
var gulp = require('gulp'); var fs = require('fs'); gulp.task('readfile', function() { return gulp.src('app/dataconfog.json') .pipe(fs.readfile("app/dataconfog.json", function(err, data){ fs.writefile('app/scripts/apiconfig.js', data); })) .pipe(gulp.dest('./dest/')) })
but getting following error:
any appreciated
try using this
var fs = require("fs"); gulp.task('dosometing', function() { return gulp.src(dirs.src + '/templates/*.html') .pipe(fs.readfile("path/to/file.something", "utf-8", function(err, _data) { //do data })) .pipe(gulp.dest('destination/path')); });
Comments
Post a Comment