Socket
Socket
Sign inDemoInstall

campaign

Package Overview
Dependencies
6
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.2 to 4.1.0

6

CHANGELOG.md

@@ -1,3 +0,7 @@

# 4.0.1 Nip Tuck
# 4.1.0 Format Wars
- Introduced `formatting` option to modify HTML right before submission
# 4.0.2 Nip Tuck
- Minor internal nitpicking

@@ -4,0 +8,0 @@ - Cleaned up dependency tree

2

package.json

@@ -14,3 +14,3 @@ {

},
"version": "4.0.2",
"version": "4.1.0",
"licenses": "MIT",

@@ -17,0 +17,0 @@ "keywords": [

![campaign.png][9] ![ga](https://ga-beacon.appspot.com/UA-35043128-6/campaign/readme?pixel)
[![help me on gittip](http://gbindex.ssokolow.com/img/gittip-43x20.png)](https://www.gittip.com/bevacqua/) [![flattr.png](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=nzgb&url=https%3A%2F%2Fgithub.com%2Fbevacqua%2Fcampaign)
[![Support](https://supporter.60devs.com/api/b/f4co3kmopd9mngbzjgn6ymbug/campaign)](https://supporter.60devs.com/support/f4co3kmopd9mngbzjgn6ymbug/campaign)

@@ -87,2 +88,3 @@ > Compose responsive email templates easily, fill them with models, and send them out.

"layout": null,
"formatting": null,
"headerImage": null,

@@ -124,2 +126,12 @@ "trap": false

### `formatting`
When you want to customize HTML before submission, but after your template engine and layout have been rendered into a single piece of HTML, you can use the `formatting` option. Useful for tweaking CSS or markup in a global manner for all emails without having to touch the models every time.
```js
function formatting (html) {
return change(html);
}
```
### `headerImage`

@@ -351,5 +363,5 @@

If the existing providers don't satisfy your needs, you may provide your own. The `provider` option just needs to be an object with a `send` method. For an example, check out the [`campaign-nodemailer` provider source code][20].
If the existing providers don't satisfy your needs, you may provide your own. The `provider` option just needs to be an object with a `send` method.
To create your own email-sending provider, you'll need to create a module that implements the interface methods found below. See [`campaign-mailgun`][25] for an example on how you could implementat your own email-sending provider.
To create your own email-sending provider, you'll need to create a module that implements the interface methods found below. See [`campaign-mailgun`][25] for an example on how you could implement your own email-sending provider.

@@ -378,3 +390,3 @@ ```js

To create your own template engine, you'll need to create a module that implements the interface methods found below. See [`campaign-jadum`][24] for an example on how you could implementat your own template engine.
To create your own template engine, you'll need to create a module that implements the interface methods found below. See [`campaign-jadum`][24] for an example on how you could implement your own template engine.

@@ -381,0 +393,0 @@ ```js

@@ -47,17 +47,21 @@ 'use strict';

function updateModel (html, next) {
model.html = tweak(html);
model.html = tweak(formatting(html));
next();
function tweak (html) {
var rtweaker = /(\{{2,})([\w._-]+)(\}{2,})/g;
if (options.provider.tweakPlaceholder) {
return html.replace(rtweaker, tweaker);
}
return html;
}
function formatting (html) {
return options.formatting ? options.formatting(html) : html;
}
function tweak (html) {
var rtweaker = /(\{{2,})([\w._-]+)(\}{2,})/g;
if (options.provider.tweakPlaceholder) {
return html.replace(rtweaker, tweaker);
}
function tweaker (all, left, content, right) {
var raw = left.length === 3 && right.length === 3;
return options.provider.tweakPlaceholder(content, raw);
}
return html;
}
function tweaker (all, left, content, right) {
var raw = left.length === 3 && right.length === 3;
return options.provider.tweakPlaceholder(content, raw);
}
function providerSend (next) {

@@ -64,0 +68,0 @@ if (send) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc