Skip to content
New issue

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

Export fails due to ejs error #24

Closed
sakamies opened this issue May 15, 2017 · 2 comments
Closed

Export fails due to ejs error #24

sakamies opened this issue May 15, 2017 · 2 comments

Comments

@sakamies
Copy link

Not sure what's going on. With pingy dev the page works fine, but pingy export fails.

I narrowed it down so I have only an index.ejs and one included partial.

index.ejs:

<!DOCTYPE html>
<html>
  <head>
  <title>jkl</title>
  </head>
  <body>

    <%- include('a', {a: 'a'}) %>

  </body>
</html>

a.ejs:

a: <%= a %>

Here's the whole log:

✖ Failed export to /Users/sakamies/Desktop/pingytest/dist
{ ReferenceError: /Users/sakamies/Desktop/pingytest/a.ejs:1
 >> 1| a: <%= a %>
    2| 

a is not defined
    at eval (eval at compile (/Users/sakamies/Desktop/pingytest/node_modules/ejs/lib/ejs.js:524:12), <anonymous>:10:26)
    at returnedFn (/Users/sakamies/Desktop/pingytest/node_modules/ejs/lib/ejs.js:555:17)
    at Object.exports.render (/Users/sakamies/Desktop/pingytest/node_modules/ejs/lib/ejs.js:364:37)
    at /Users/sakamies/Desktop/pingytest/node_modules/accord/lib/adapters/ejs/2.x.js:33:31
    at compile (/Users/sakamies/Desktop/pingytest/node_modules/accord/lib/adapters/ejs/2.x.js:64:15)
    at EJS._render (/Users/sakamies/Desktop/pingytest/node_modules/accord/lib/adapters/ejs/2.x.js:31:14)
    at EJS.Adapter.render (/Users/sakamies/Desktop/pingytest/node_modules/accord/lib/adapter_base.js:124:19)
    at continuation.then.source (/Users/sakamies/Desktop/pingytest/node_modules/@pingy/compile/lib/baby-tolk.js:199:17)
    at tryCatchReject (/Users/sakamies/Desktop/pingytest/node_modules/when/lib/makePromise.js:845:30)
    at runContinuation1 (/Users/sakamies/Desktop/pingytest/node_modules/when/lib/makePromise.js:804:4) path: '/Users/sakamies/Desktop/pingytest/a.ejs' }
Macintosh:pingytest sakamies$ 
@davej
Copy link
Member

davej commented May 18, 2017

I'm on holidays at the moment so I can't verify but my guess is that it's trying to compile a.ejs as a standalone file. Pingy has a convention where you use the underscore character to mark a file as a partial. Can you try renaming the file to _a.js and include it as <%- include('_a', {a: 'a'}) %> too. Let me know if that works for you.

@sakamies
Copy link
Author

That fixed it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants