foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

1.5.0 introduces incompatibility with gulp & renaming #132

Closed kball closed 7 years ago

kball commented 7 years ago

Recently did a reinstall of node modules in Foundation and found that the new version of panini breaks the docs compilation stream. This can be traced to this PR: https://github.com/zurb/panini/pull/129/files

Backtrace is below, but essentially the issue is that panini is re-opening files based on the path in the file object, however if gulp has renamed that path in some way (in docs some things have happened to change path from .md to .html before we hit panini). I'm not super familiar with the fs api but any way we can do the stripping based on the file passed in rather than having to reread it?

backtrace:

Panini: rendering error ocurred.                                                                             
 { Error: ENOENT: no such file or directory, open '/Users/kball/git/foundation-sites/docs/pages/dropdown-menu.html'        
    at Error (native)                                                                                            
    at Object.fs.openSync (fs.js:641:18)                                                                      
    at Object.fs.readFileSync (fs.js:509:33)                                                                 
    at Object.exports.readWithoutBOM (/Users/kball/git/foundation-sites/node_modules/panini/lib/utils.js:33:21)            
    at Panini.render (/Users/kball/git/foundation-sites/node_modules/panini/lib/render.js:21:25)                           
    at DestroyableTransform.Transform._read (/Users/kball/git/foundation-sites/node_modules/readable-stream/lib/_stream_transform.js:182:10)                                                                                            
    at DestroyableTransform.Transform._write (/Users/kball/git/foundation-sites/node_modules/readable-stream/lib/_stream_transform.js:170:83)                                                                                         
    at doWrite (/Users/kball/git/foundation-sites/node_modules/readable-stream/lib/_stream_writable.js:406:64)             
    at writeOrBuffer (/Users/kball/git/foundation-sites/node_modules/readable-stream/lib/_stream_writable.js:395:5)        
    at DestroyableTransform.Writable.write (/Users/kball/git/foundation-sites/node_modules/readable-stream/lib/_stream_writable.js:322:11)                                                                                              
gakimball commented 7 years ago

Yeah, re-reading the file is unnecessary; the BOM stripping should be applied to file.contents. I'll get a fix in soon.

gakimball commented 7 years ago

Released v1.5.1 to address this.