Skip to content

Instantly share code, notes, and snippets.

@ThomasLarge
Created March 9, 2018 10:36
Show Gist options
  • Save ThomasLarge/3eb9f483f56b2320b64c57c30efdea99 to your computer and use it in GitHub Desktop.
Save ThomasLarge/3eb9f483f56b2320b64c57c30efdea99 to your computer and use it in GitHub Desktop.
Foundation email / Inky - Outlook background colour fix - Add bgcolor to toplevel wrappers and rows
# Find the file in the Node
node_modules/inky/lib/componentFactory.js
# You then need to modify the file to the below for this to work.
# You can also use this on other elements I have also done this on the Wrapper class
// Row amends - Row line 19
// Original
// <row>
case this.components.row:
var classes = ['row'];
if (element.attr('class')) {
classes = classes.concat(element.attr('class').split(' '));
}
return format('<table class="%s"><tbody><tr>%s</tr></tbody></table>', classes.join(' '), inner);
// Amended
// <row>
case this.components.row:
var classes = ['row'];
var bgcolor = "";
if (element.attr('class')) {
classes = classes.concat(element.attr('class').split(' '));
}
if (element.attr('bgcolor')) {
bgcolor = (element.attr('bgcolor'));
}
return format('<table class="%s" bgcolor="'+bgcolor+'"><tbody><tr>%s</tr></tbody></table>', classes.join(' '), inner);
// Wrapper amends - Row line 155
// Original
// <wrapper>
case this.components.wrapper:
var classes = ['wrapper'];
if (element.attr('class')) {
classes = classes.concat(element.attr('class').split(' '));
}
return format('<table %s class="%s" align="center"><tr><td class="wrapper-inner">%s</td></tr></table>', attrs, classes.join(' '), inner);
// Amended
// <wrapper>
case this.components.wrapper:
var classes = ['wrapper'];
var bgcolor = "";
if (element.attr('class')) {
classes = classes.concat(element.attr('class').split(' '));
}
if (element.attr('bgcolor')) {
bgcolor = (element.attr('bgcolor'));
}
return format('<table %s class="%s" align="center" bgcolor="'+bgcolor+'"><tr><td class="wrapper-inner">%s</td></tr></table>', attrs, classes.join(' '), inner);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment