GithubHelp home page GithubHelp logo

maxlapides / dovetailer Goto Github PK

View Code? Open in Web Editor NEW
16.0 9.0 1.0 474 KB

Use Sass and Nunjucks to generate HTML emails with text versions, optimized for all email clients and ready to send.

License: Apache License 2.0

CSS 5.96% JavaScript 92.13% HTML 1.91%
html-emails emails

dovetailer's People

Contributors

kengz avatar maxlapides avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rossman15

dovetailer's Issues

ESP Merge tags / Dynamic data being removed from anchor tags.

We had a section where we needed to call in a dynamic link, the ESP utilizes a similar handlebars data structure. <a href="{{ Dynamic_Link }}">.

The compiled file in the build folder would then end up having a blank anchor <a href></a>.

The only way we found to work around this issue was to go into the compiled build file and manually re-enter the data.

HTML symbols getting converted to HTML entities.

Normal HTML quotes are being converted into html entities.

Example:

Code in html.handlebars:
<div id="preview_text" style="display:none !important; mso-hide:all; max-height:0; overflow:hidden; ">{% text "preview_text" label="Preview Text <span class="help-text">This will be used as the preview text that displays in some email clients</span>", value="", no_wrapper=True %}</div>

Output in production file:
<div style="display:none!important;mso-hide:all;max-height:0;overflow:hidden">{% text &quot;preview_text&quot; label=&quot;Preview Text <span>This will be used as the preview text that displays in some email clients</span>&quot;, value=&quot;&quot;, no_wrapper=True %}</div>

Can we change the conversion of symbols to only happen within data from content.json? I see this as beneficial, but changing intentional code within the html does not seem safe.

Is there a better solution for this problem?

Outlook Hi-DPI Requirement

Two items must be applied to the top of every template to insure compatibility with hi-DPI windows settings affecting Outlook.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

Which allows for this fix:

<!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG/> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]-->

Background images

For development with local images, it seems as though background image sources are not causing a copy of the image to be placed into the Build folder for the template.

Is this feature limited to <img tags alone? Or can this be handled for background: url('{{src}}'); and background="{{src}}" as well?

Partials don't seem to be registered properly

Project structure

- /build
- /styles
- /templates
  - /_partials
    - footer.handlebars
    - hacks.handlebars
  - /referral
    - content.json
    - html.handlebars
    - style.scss
    - text.handlebars
- index.js
- package.json
- yarn.lock

index.js (compiler)

#!/usr/bin/env node
var compiler = require('dovetailer');
var path = require('path');

compiler(path.resolve('templates'), path.resolve(__dirname, 'templates/_partials'));

package.json (compile script)

...
"scripts": {
    "build": "./index.js"
},
...

Running npm run build results in three ENOENT errors:

Error: ENOENT: no such file or directory, open '/Users/<x>/Repositories/<y>/Emails/templates/_partials/html.handlebars'
    at Error (native)
Error: ENOENT: no such file or directory, open '/Users/<x>/Repositories/<y>/Emails/templates/_partials/text.handlebars'
    at Error (native)
Error: ENOENT: no such file or directory, open '/Users/<x>/Repositories/<y>/Emails/templates/_partials/content.json'

From what I can tell, it looks like it's treating the _partials directory the same way it treats my referral template directory. What am I missing here? :)

Folder structure and mono-repository functionality

It would be beneficial to be able to have a folder structure like so:

Templates (Main folder):

  • [Client Name] Folder
    -- Welcome EM1
    -- Welcome EM2
    -- ETC.

Also, this could allows us to utilize a global client stylesheet and/or variable file.

Broken image urls result in gulp crashing

Just updated a remote image to take advantage of the retina scaling dovetailer does and am waiting for the updated resource to deploy. I updated my html to use the new URL, and gulp crashed with the following since the URL wasn't yet valid:

> <y>@0.0.1 start /Users/<a>/Repositories/<x>/<y>
> gulp

[17:15:31] Using gulpfile ~/Repositories/<x>/<y>/gulpfile.js
[17:15:31] Starting 'compile'...
[17:15:31] Starting 'watch'...
[17:15:31] Finished 'watch' after 14 ms
/Users/<a>/Repositories/<x>/<y>/node_modules/image-size/lib/index.js:34
  throw new TypeError('unsupported file type: ' + type + ' (file: ' + filepath + ')');
  ^

TypeError: unsupported file type: undefined (file: undefined)

Destructuring in build.js throws undefined/null

Another one for ya!

Parameters

  • No CSS/styles used

Test HTML (from example here)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="initial-scale=1.0">    <!-- So that mobile webkit will display zoomed in -->
    <meta name="format-detection" content="telephone=yes"> <!-- disable auto telephone linking in iOS -->
    <title>Test</title>
</head>
<body>
    <table>
        <tr>
            <td align="center">
                <p>This is a {{from_name}}. Some "quoted text."</p>
                <p>{{from_email}}</p>
                <p>© Awesomepants McChunkmuffins</p>
            </td>
        </tr>
    </table>
</body>
</html>

content.json

{
    "from_name": "{{from_name}}",
    "from_email": "{{from_email}}"
}

Error

error:  TypeError: Cannot match against 'undefined' or 'null'.

Build.js console.log digging
Changed Promise.all.then(([ { html, text }, css ]) => { ... }); to Promise.all.then((response) => { console.log(response); }); and got this:

error:
[ undefined,
  { customResets: { resetHead: false, resetInline: false },
    main: { head: '', inline: '' },
    reset:
     { head: '/*\n * Various CSS Resets to troubleshoot rendering problems.\n * ----------------\n * All files: reset-head.scss, reset-inline.scss\n * All styles are inlined into index.html by the html-email-generator.\n * Sources: Mailchimp Email Blueprints https://github.com/mailchimp/Email-Blueprints; HTML Email Boilerplate: http://www.paulund.co.uk/html-email-boilerplate\n*/\n.ReadMsgBody {\n  width: 100%;\n}\n\n.ExternalCla}}]
info: Emails compiled and saved.

Quotes deleted when empty

There are cases where you might want an empty alt tag on an image, like for a spacer image. It’s best practice to have the alt attribute on all images, even if it’s empty, it’s better than none at all. And since it is blank, it's less annoying for screen readers to have nothing there than to say something like "blank spacer image" and less abrasive if the image doesn't load to not have actual alt text show up and thereby keep it as small as possible.
The compiler is currently deleting said empty quotes, as seen below:

2836650129-screen shot 2017-03-14 at 11 22 01 am
2457946575-screen shot 2017-03-14 at 11 21 47 am

Classes and ID's utilized by ESPs being removed.

We had a situation where we were provided a snippet of code from an ESP (Hubspot in this situation) where they utilized an ID on the element (Pre-header text <div). Once compiled, the automatic feature to remove unused classes and ID's had removed the ID and broke the functionality within the ESP.

Is it possible to only remove classes that produce inline CSS in the compiled version and keep any classes or ID's that have no CSS settings applied to them?

Content.json should be optional

The project I'm working on is not relying on the compiler for inserting dynamic data, so we don't need config files for our templates. It'd be great if the compiler left {{ data }} tokens untouched (ready for being replaced later in the chain) if there was no config available for the template.

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.