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

Error: ENOENT for index.swig? #328

Closed
etodanik opened this issue Oct 4, 2018 · 4 comments
Closed

Error: ENOENT for index.swig? #328

etodanik opened this issue Oct 4, 2018 · 4 comments

Comments

@etodanik
Copy link

etodanik commented Oct 4, 2018

I'm trying to use this with swig. I was on 2.x branch and it worked. I did some rewriting, to try to make v5 work. I'm getting this kind of error:

Error: ENOENT: no such file or directory, open '/Users/danny/src/project/mail/templates/comment/index.swig

I'm not specifying any unusual settings otherwise. There is an html.swig file at that path, and I'm not sure why it would look for index.swig? Is this expected behaviour? Any help would be appreciated.

@niftylettuce
Copy link
Collaborator

niftylettuce commented Oct 4, 2018

It's probably due to this package https://github.com/niftylettuce/get-paths/blob/master/index.js#L13 specifically trying to fetch the index.swig file.

Are you using just the render method? If so that is why it is looking for index.swig - see https://github.com/niftylettuce/email-templates/blob/master/src/index.js#L109-L117. Notice that the README shows https://github.com/niftylettuce/email-templates#render-html-andor-text using /html.

@etodanik
Copy link
Author

etodanik commented Oct 4, 2018

@niftylettuce alright, thanks a lot! that helped! A related (but maybe unrelated) question:
v2.x used to automatically pull up style.swig, but v5.x seems not to. Is this by design? Is there a way to automatically include style.swig like it used to?

@niftylettuce
Copy link
Collaborator

@israelidanny see https://github.com/niftylettuce/email-templates#automatic-inline-css-via-stylesheets

You'll need to add in your html.swig template file, in the <head> section a <style> tag as that link suggests. You'll also need to ensure your style.swig is compiled to style.css, and use the .css version in the href attribute of the <style> tag you add.

@etodanik
Copy link
Author

etodanik commented Oct 4, 2018

@niftylettuce thanks a lot! everything works now!

@etodanik etodanik closed this as completed Oct 4, 2018
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