We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compileFile()
compile()
compile() returns fn(locals, callback) -- expected, is like pug https://github.com/pugjs/then-pug/blob/master/packages/then-pug/lib/index.js#L384
fn(locals, callback)
compileFile() returns type stream -- unexpected, should be like compile() https://github.com/pugjs/then-pug/blob/master/packages/then-pug/lib/index.js#L477
Workaround :
import {promises as fs} from 'fs'; async function renderAsync(filepath, locals) { let options = {filename: filepath}; let fn = pug.compile(await fs.readFile(options.filename, 'utf8'), options); // promise helper return new Promise( ret => fn(locals, (e,r) => ret(r)) ); } let html = await renderAsync('filename', {...locals});
The text was updated successfully, but these errors were encountered:
Thanks for the report.
I must admit that I never used compileFile in then-pug because it reads file synchronously so I am not surprised its behavior is not as expected.
then-pug
I will have to think whether it should be removed altogether from then-pug or see how we can patch the caching mechanism in handleTemplateCache
handleTemplateCache
Sorry, something went wrong.
The only reason for me, was because of a different caching method I implemented (using LRU).
No branches or pull requests
compile()
returnsfn(locals, callback)
-- expected, is like pughttps://github.com/pugjs/then-pug/blob/master/packages/then-pug/lib/index.js#L384
compileFile()
returns type stream -- unexpected, should be likecompile()
https://github.com/pugjs/then-pug/blob/master/packages/then-pug/lib/index.js#L477
Workaround :
The text was updated successfully, but these errors were encountered: