mails 0.2.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +142 -0
- package/README.md +178 -108
- package/README.zh.md +156 -0
- package/dist/cli.js +668 -0
- package/dist/index.js +411 -0
- package/package.json +46 -24
- package/skill.md +213 -0
- package/.npmignore +0 -6
- package/LICENSE +0 -19
- package/README.en.md +0 -102
- package/dist/render.js +0 -42
- package/dist/render.js.map +0 -1
- package/libs/render.js +0 -21
package/.npmignore
DELETED
package/LICENSE
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2013 turing <o.u.turing@gmail.com>
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
package/README.en.md
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
##  mails 
|
|
2
|
-
|
|
3
|
-
Send beautiful emails made easy, with responsive templates built in.
|
|
4
|
-
|
|
5
|
-
Mails supports [ink](http://zurb.com/ink) responsive email template now!
|
|
6
|
-
|
|
7
|
-
### Installation
|
|
8
|
-
```bash
|
|
9
|
-
$ npm install mails
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Example
|
|
13
|
-
```js
|
|
14
|
-
var mails = require('mails');
|
|
15
|
-
|
|
16
|
-
// Use built in templates
|
|
17
|
-
mail.render('basic', {
|
|
18
|
-
name: 'mySite',
|
|
19
|
-
banner: 'http://mysite.com/banner.jpg'
|
|
20
|
-
}, function(err,html){
|
|
21
|
-
if (!err) {
|
|
22
|
-
console.log(html);
|
|
23
|
-
} else {
|
|
24
|
-
console.log(err);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
### Built-in themes
|
|
29
|
-
Mails supports several kinds of themes, they are:
|
|
30
|
-
|
|
31
|
-
- ink themes:
|
|
32
|
-
- basic
|
|
33
|
-
- hero
|
|
34
|
-
- newsletter
|
|
35
|
-
- sidebar
|
|
36
|
-
- sidebar-hero
|
|
37
|
-
- mails theme:
|
|
38
|
-
- one
|
|
39
|
-
|
|
40
|
-
#### built-in theme useage:
|
|
41
|
-
```js
|
|
42
|
-
var mails = require('mails');
|
|
43
|
-
|
|
44
|
-
mails.render('basic', {
|
|
45
|
-
name: 'mySite',
|
|
46
|
-
banner: 'http://mysite.com/banner.jpg'
|
|
47
|
-
}, function(err, html){
|
|
48
|
-
// do sth.
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
#### built-in theme variables:
|
|
52
|
-
Take a look:
|
|
53
|
-
(screenshots coming soon...)
|
|
54
|
-
|
|
55
|
-
### Templates as NPM modules
|
|
56
|
-
You can also push templates as NPM modules, like this:
|
|
57
|
-
```js
|
|
58
|
-
var mails = require('mails');
|
|
59
|
-
|
|
60
|
-
// Using templates named `single` under module `mails-mailmao`
|
|
61
|
-
mails.render('mails-mailmao/single', {
|
|
62
|
-
name: 'mySite',
|
|
63
|
-
banner: 'http://mysite.com/banner.jpg'
|
|
64
|
-
}, function(err, html){
|
|
65
|
-
// do sth.
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
please feel free to publish your templates to NPM.
|
|
69
|
-
|
|
70
|
-
### Contributing
|
|
71
|
-
- Fork this repo
|
|
72
|
-
- Clone your repo
|
|
73
|
-
- Install dependencies
|
|
74
|
-
- Checkout a feature branch
|
|
75
|
-
- Feel free to add your features
|
|
76
|
-
- Make sure your features are fully tested
|
|
77
|
-
- Open a pull request, and enjoy <3
|
|
78
|
-
|
|
79
|
-
### MIT license
|
|
80
|
-
Copyright (c) 2013 turing <o.u.turing@gmail.com>
|
|
81
|
-
|
|
82
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
83
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
84
|
-
in the Software without restriction, including without limitation the rights
|
|
85
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
86
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
87
|
-
furnished to do so, subject to the following conditions:
|
|
88
|
-
|
|
89
|
-
The above copyright notice and this permission notice shall be included in
|
|
90
|
-
all copies or substantial portions of the Software.
|
|
91
|
-
|
|
92
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
93
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
94
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
95
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
96
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
97
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
98
|
-
THE SOFTWARE.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-

|
|
102
|
-
generated using [docor](https://github.com/turingou/docor.git) @ 0.1.0. brought to you by [turingou](https://github.com/turingou)
|
package/dist/render.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
8
|
-
|
|
9
|
-
var _juice = require('juice');
|
|
10
|
-
|
|
11
|
-
var _juice2 = _interopRequireDefault(_juice);
|
|
12
|
-
|
|
13
|
-
var _bluebird = require('bluebird');
|
|
14
|
-
|
|
15
|
-
var _bluebird2 = _interopRequireDefault(_bluebird);
|
|
16
|
-
|
|
17
|
-
var _pkghubRender = require('pkghub-render');
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 根据给定的主题名称或者文件名称渲染邮件
|
|
21
|
-
* @example
|
|
22
|
-
* render('mails-flat/message', {...}).then(inlineHTML).catch(err)
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var _pkghubRender2 = _interopRequireDefault(_pkghubRender);
|
|
26
|
-
|
|
27
|
-
exports['default'] = function (template) {
|
|
28
|
-
var data = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
29
|
-
|
|
30
|
-
if (template.indexOf('/') === -1) template = 'mails-default/' + template;
|
|
31
|
-
|
|
32
|
-
return (0, _pkghubRender2['default'])(template, data).then(function (html) {
|
|
33
|
-
try {
|
|
34
|
-
return _bluebird2['default'].resolve((0, _juice2['default'])(html));
|
|
35
|
-
} catch (err) {
|
|
36
|
-
return _bluebird2['default'].reject(err);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
module.exports = exports['default'];
|
|
42
|
-
//# sourceMappingURL=render.js.map
|
package/dist/render.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../libs/render.js"],"names":[],"mappings":";;;;;;;;qBAAkB,OAAO;;;;wBACL,UAAU;;;;4BACX,eAAe;;;;;;;;;;qBAOnB,UAAS,QAAQ,EAAa;MAAX,IAAI,yDAAG,EAAE;;AACzC,MAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAC9B,QAAQ,sBAAoB,QAAQ,AAAE,CAAA;;AAExC,SAAO,+BAAO,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI,EAAI;AACzC,QAAI;AACF,aAAO,sBAAQ,OAAO,CAAC,wBAAM,IAAI,CAAC,CAAC,CAAA;KACpC,CAAC,OAAO,GAAG,EAAE;AACZ,aAAO,sBAAQ,MAAM,CAAC,GAAG,CAAC,CAAA;KAC3B;GACF,CAAC,CAAA;CACH","file":"render.js","sourcesContent":["import juice from 'juice'\nimport Promise from 'bluebird'\nimport render from 'pkghub-render'\n\n/**\n * 根据给定的主题名称或者文件名称渲染邮件\n * @example\n * render('mails-flat/message', {...}).then(inlineHTML).catch(err)\n */\nexport default function(template, data = {}) {\n if (template.indexOf('/') === -1)\n template = `mails-default/${template}`\n\n return render(template, data).then(html => {\n try {\n return Promise.resolve(juice(html))\n } catch (err) {\n return Promise.reject(err)\n }\n })\n}"]}
|
package/libs/render.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import juice from 'juice'
|
|
2
|
-
import Promise from 'bluebird'
|
|
3
|
-
import render from 'pkghub-render'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 根据给定的主题名称或者文件名称渲染邮件
|
|
7
|
-
* @example
|
|
8
|
-
* render('mails-flat/message', {...}).then(inlineHTML).catch(err)
|
|
9
|
-
*/
|
|
10
|
-
export default function(template, data = {}) {
|
|
11
|
-
if (template.indexOf('/') === -1)
|
|
12
|
-
template = `mails-default/${template}`
|
|
13
|
-
|
|
14
|
-
return render(template, data).then(html => {
|
|
15
|
-
try {
|
|
16
|
-
return Promise.resolve(juice(html))
|
|
17
|
-
} catch (err) {
|
|
18
|
-
return Promise.reject(err)
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
}
|