maxlapides / dovetailer Goto Github PK
View Code? Open in Web Editor NEWUse Sass and Nunjucks to generate HTML emails with text versions, optimized for all email clients and ready to send.
License: Apache License 2.0
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
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.
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 "preview_text" label="Preview Text <span>This will be used as the preview text that displays in some email clients</span>", value="", 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?
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]-->
I'm noticing sourcemaps being added to the final production html files in the build folder. This is increasing file-size dramatically.
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?
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? :)
It would be beneficial to be able to have a folder structure like so:
Templates (Main folder):
Also, this could allows us to utilize a global client stylesheet and/or variable file.
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)
Currently the compiler looks for .handlebars
files only. Might be nice to accept both .handlebars
and .hbs
.
The example gulpfile currently requires config.js
, which doesn't exist. It'd be great if an example config were available to see what kind of object is expected.
Another one for ya!
Parameters
Test HTML (from example here)
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.
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:
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.