build-email
Version:
Framework & CLI Build Email - thiết kế HTML Email Template với Tailwind CSS, kế thừa Maizzle.
21 lines (17 loc) • 633 B
JavaScript
import posthtml from 'posthtml'
import get from 'lodash-es/get.js'
import urlParameters from 'posthtml-url-parameters'
export default function posthtmlPlugin(options = {}) {
const { _options, ...parameters } = options
const tags = get(_options, 'tags', ['a'])
const strict = get(_options, 'strict', true)
const qs = get(_options, 'qs', { encode: false })
return urlParameters({ parameters, tags, qs, strict })
}
export async function addURLParams(html = '', options = {}, posthtmlOptions = {}) {
return posthtml([
posthtmlPlugin(options)
])
.process(html, posthtmlOptions)
.then(result => result.html)
}