Closed birdxiao closed 8 years ago
Oh yeah, I can see the style and undefined fs problem, I'll fix those right away, thanks!
But about the other thing, I'm not sure I follow. Where would dest come from? Currently it directly uses the path you give it. Can you elaborate on that one?
I will try my best to describe it. (My English is not well! )
if i have be the follow code:
gulp.src('./js/**/*.js')
.pipe(hash())
.pipe(gulp.dest('public/js'))
.pipe(hash.manifest('assets.json'))
.pipe(gulp.dest('public'));
the absolute path of assets.json is process.cwd() + '/public/assets.json'
but in your code on line 75 has the follow code:
var content = fs.readFileSync(manifestPath, {encoding: 'utf8'});
if the manifestPath value also is assets.json and gulp.dest is public, the manifestPath exact value is process.cwd() + '/assets.json' but my expected value is process.cwd() + '/public/assets.json'
I don't know you can get my point.
(Not sure if you saw my earlier reply here, I deleted it after re-reading your comment!)
I see your point now. You can work around this by putting 'public/' directly into the manifest path:
.pipe(hash.manifest('public/assets.json'))
.pipe(gulp.dest('.'))
However, setting the base dir for the file could be a useful feature as an additional parameter to hash.manifest()
. I'll see what I can do, thanks!
yes, i solve it as same as you say:
.pipe(hash.manifest('public/assets.json'))
.pipe(gulp.dest('.'))
I think you can do better! thanks!
hello, may be you can lint your code by eslint, there are many style problem.
and
hash.manifest function design has a problem, why not fs.readFileSync(dest + manifestPath, {encoding: 'utf8'}); in line 74.