Closed ehsanonline closed 4 years ago
Merging #377 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #377 +/- ##
=======================================
Coverage 89.38% 89.38%
=======================================
Files 1 1
Lines 113 113
=======================================
Hits 101 101
Misses 12 12
Impacted Files | Coverage Δ | |
---|---|---|
src/index.js | 89.38% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 065c5fb...fce7c03. Read the comment docs.
Can you please change this PR so that it is a function instead of a String? The function would accept three arguments, type
, template
, locals
and return a String.
e.g. const str = this.config.getPath(type, template, locals)
and
getPath = function(type, template) { return `${template}/${type}`; }
I've released this feature in v6.1.0. See the README for config.getPath
function. Just pass your custom function and it should work.
I've also fixed it by default to use path.sep
from Node's internal path package, so it should work better cross platform (e.g. instead of ${a}/${b}
it is now path.join(a, b)
.
npm install email-templates@latest`
or with yarn
yarn add email-templates@latest
I like to have all of my files and templates in root folder, instead of template folder, and organize them like this:
So I add a
path
key toview
option, that is a path format for templates structure. It's a string that could contain:<template>
as template name.<type>
as one of these file types:html
,text
,subject
.<sep>
as the operating system path separator like/
or\
All of them will be replaced automatically. For the example above, the path is
<template>.<type>
. The default path is<template><sep><type>
.