forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

Inline styles in v3 #242

Closed dottodot closed 7 years ago

dottodot commented 7 years ago

Should inline styles work the same as V2. i.e including a style.css in the template folder.

It's not working and there is nothing in the documentation about it.

niftylettuce commented 7 years ago

I believe so - are you interested in writing a test case that fails and then I can patch?

dottodot commented 7 years ago

If you run this example https://github.com/dottodot/email you'll see there is styles included in the resulting html.

niftylettuce commented 7 years ago

@dottodot sorry the docs were missing for this - see https://github.com/niftylettuce/email-templates#automatic-inline-css-via-stylesheets

dottodot commented 7 years ago

Thanks but that documentation is slightly wrong, it should be

    const email = new Email({
        // <https://github.com/Automattic/juice>
        juice: true,
        juiceResources: {
          preserveImportant: true,
          webResources: {
               // default path is `build/`:
          relativeTo: path.resolve('build')

              //
              // but you might want to change it to something like:
              // relativeTo: path.join(__dirname, '..', 'assets')
              //
          }
        }
      });

not

const email = new Email({
  // <https://github.com/Automattic/juice>
  juice: true,
  webResources: {
    preserveImportant: true,

    // default path is `build/`:
    relativeTo: path.resolve('build')

    //
    // but you might want to change it to something like:
    // relativeTo: path.join(__dirname, '..', 'assets')
    //

  }
});
niftylettuce commented 7 years ago

updated docs, thanks @dottodot if you see anything else please let me know. also feel free to join us in slack, see https://lad.js.org for more info + the slack link