javascript - Gulp Task completes with no error but no file is saved to destination -
i stuck in kind of trivial issue , can not hang of it.
here scenario:
i using gulp task convert html
templates javascript
using gulp-html2js
environment node v6.9.1, gulp 3.9.1, windows 7
here gulpfile.js
var gulp = require('gulp'); var concat = require('gulp-concat'); var html2js = require('gulp-html2js'); var sourcedir = "d:\programs_insalled\nodejs\nodeapps\myapp" gulp.task('templates', function() { return gulp.src( 'd:\programs_insalled\nodejs\nodeapps\myapp\templates\*.html'). pipe(html2js({outputmodulename: 'templates'})). pipe(concat('templates.js')). pipe(gulp.dest('d:\programs_insalled\nodejs\nodeapps\myapp\bin')); });
when run task, completes, in few m-sec templates.js
not generated in bin
directory
d:\programs_insalled\nodejs\nodeapps\myapp>gulp templates [15:28:45] using gulpfile d:\programs_insalled\nodejs\nodeapps\myapp\gulpfile.js [15:28:45] starting 'templates'... [15:28:45] finished 'templates' after 19 ms
i have tried below suggestions in similar items listed on github , stackoverflow have not been successful,
https://github.com/yeoman/generator-webapp/issues/182 https://github.com/yeoman/generator-webapp/issues/225
can out find mistake.
thanks.
edit output of provided examples:
d:\programs_insalled\nodejs\nodeapps\myapp>gulp models [17:13:10] using gulpfile d:\programs_insalled\nodejs\nodeapps\myapp\gulpfile.js [17:13:10] starting 'models'... [17:13:10] finished 'models' after 21 ms d:\programs_insalled\nodejs\nodeapps\myapp>gulp templates [17:13:13] using gulpfile d:\programs_insalled\nodejs\nodeapps\myapp\gulpfile.js [17:13:13] starting 'templates'... d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\vinyl\index.js:120 if (!this.path) throw new error('no path specified! can not relative.'); ^ error: no path specified! can not relative. @ file.get (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\vinyl\index.js:120:27) @ destroyabletransform.buffercontents [as _transform] (d:\programs_insalled\nodejs\nodeapps\mya pp\node_modules\gulp-concat\index.js:70:20) @ destroyabletransform.transform._read (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules \gulp-concat\node_modules\readable-stream\lib\_stream_transform.js:184:10) @ destroyabletransform.transform._write (d:\programs_insalled\nodejs\nodeapps\myapp\node_module s\gulp-concat\node_modules\readable-stream\lib\_stream_transform.js:172:12) @ dowrite (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\gulp-concat\node_modules\rea dable-stream\lib\_stream_writable.js:237:10) @ writeorbuffer (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\gulp-concat\node_modul es\readable-stream\lib\_stream_writable.js:227:5) @ destroyabletransform.writable.write (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\ gulp-concat\node_modules\readable-stream\lib\_stream_writable.js:194:11) @ destroyabletransform.ondata (d:\programs_insalled\nodejs\nodeapps\myapp\node_modules\through2 \node_modules\readable-stream\lib\_stream_readable.js:531:20) @ emitone (events.js:96:13) @ destroyabletransform.emit (events.js:188:7) d:\programs_insalled\nodejs\nodeapps\myapp>
. pipe better before pipe, give e.g of 1 of gulpile , not need put absolute machine path in dest gulpfile root path of task gulp work js use js path try inever use html2js dont know if syntax correct first try path
my e.g
gulp.task('models', function(){ return gulp.src('models/*.*') .pipe(gulp.dest('../dist/models')) });
try you
gulp.task('templates', function() { return gulp.src( 'templates/*.html') .pipe(html2js({outputmodulename: 'templates'})) .pipe(concat('templates.js')) .pipe(gulp.dest('bin')) });
Comments
Post a Comment