Giter VIP home page Giter VIP logo

Comments (9)

niftylettuce avatar niftylettuce commented on May 21, 2024

EJS has an include directive https://github.com/visionmedia/ejs#includes

from email-templates.

niftylettuce avatar niftylettuce commented on May 21, 2024

Perhaps see #35 ?

from email-templates.

ragulka avatar ragulka commented on May 21, 2024

Ah, thanks. Will try it out.

from email-templates.

ragulka avatar ragulka commented on May 21, 2024

It seems that includes won't work. At least not including a css file at the moment. They are included, but not inlined. It seems that #37 would fix this?

from email-templates.

niftylettuce avatar niftylettuce commented on May 21, 2024

Per this commit https://github.com/nicjansma/node-email-templates/commit/6055829c2a6b9f001b74f6b2a474d99905bd09e6 you can use EJS with include and layout helpers. EJS requires locals.filename for relative paths of include and layout. Main documentation is https://github.com/visionmedia/ejs#layouts and see https://github.com/chovy/express-template-demo/blob/master/demo/views/index.ejs and https://github.com/chovy/express-template-demo/blob/master/demo/views/layout.ejs for examples of this.

from email-templates.

ragulka avatar ragulka commented on May 21, 2024

@niftylettuce I am not sure we understand each other. I have no problem with using include - the css is included between style tags (that works), but it is not inlined by juice. Without inlining, the styles are not applied in email.

from email-templates.

jasonsims avatar jasonsims commented on May 21, 2024

Broken @include statements were fixed for LESS in #61 and should now be inlined by juice. However, we should test out similar functionality for the other supported preprocessors before resolving this.

from email-templates.

Philmod avatar Philmod commented on May 21, 2024

Hey guys,

Is there a way to share the style file (style.css) for all the templates? For example by putting it in the root templates directory.

Thanks,
Philmod

from email-templates.

niftylettuce avatar niftylettuce commented on May 21, 2024

Yes, you can do something like this...

Folder named ./emails/. Inside of it you have different email templates, e.g. ./emails/welcome-message/ and ./emails/forgot-password/. Each of these folders has html.ejs of course and then an accompanying stylesheet style.less. At the top of style.less you have a line such as @import "../style.less"; which would import a global stylesheet located at ./emails/style.less.

from email-templates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.