Closed Inx51 closed 7 years ago
Turns out that Visual Studio adds BOM to alot of its created files... Found an extension for Visual Studio to prevent BOM.. however.. would be nice if panini just stripped that away from partials and layouts..
I just ran into this, and submitted a fix.
Merged #129.
@FracturedShader, while we're here, do you think you could do the same fix for Panini 2.0? Panini 1.0 is more or less EOL now.
I think there's two places where you'd need to do it.
First off, I'd recommend using the strip-bom library to do it. Keeps the codebase a little more slim :)
For pages, you'd probably want to add BOM stripping here, where the page is separated into Front Matter variables and a body. You can where the page.body
string is returned in this function at the end. You'd want to strip the BOM from page.body
and return the modified string instead.
For partials, there's one function the library uses to load files and read their contents, which you can see here. Right now the string comes straight from fs.readFile
, so you can modify that to strip the BOM before returning the file's contents.
@gakimball, sure thing! I'll do that after work tonight.
@FracturedShader Awesome, thank you so much! :)
Just published version 1.5.0, which has the BOM stripping.
Merged #131 to get BOM stripping into 2.0.
Hi! For some reason once I use my partials panini appears to add a BOM() before the rendered partial..
Any ideas?.. I have tried to save all my files as UTF-8.. but that doesn't do it..