eladnava/mailgen

make theme option more usable

alessioalex opened this issue · 3 comments

https://github.com/eladnava/mailgen/blob/master/index.js#L16-L22

Currently there's no way to add a custom theme without interfering with the module's /themes folder. I believe the theme option should be a path to a specific theme html file, not a name. That would make it more user friendly.

@alessioalex good idea!

The theme option is actually meant for picking another mailgen theme. Currently we only have default but there are definitely plans to support more themes.

However, what you're saying is true -- making it possible to supply your own theme would be nice, by specifying its path.

What I'm proposing is to have the theme parameter support both a string and an object, like so:

// Configure mailgen to use a custom theme
var mailGenerator = new Mailgen({
    theme: {
        path: path.resolve('public/mailgen/theme.html')
    }
});
// Or, use a mailgen theme
var mailGenerator = new Mailgen({
    theme: 'default',
});

What do you think?

I was thinking of the same thing after reading your 2nd paragraph. Good idea indeed!

@alessioalex Done, thanks for the suggestion! =)