Skip to content

Commit 537a42b

Browse files
committed
Merge pull request #134 from mjmlio/1.3-beta
1.3 release
2 parents c75d122 + 6fb77dd commit 537a42b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2072
-1068
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"presets": ["es2015", "react", "stage-0"],
3-
"plugins": ["transform-decorators-legacy"]
3+
"plugins": ["lodash", "transform-decorators-legacy", "babel-plugin-transform-inline-environment-variables"]
44
}

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"prefer-const": 2,
1515
"space-before-blocks": 2,
1616
"no-console": 0,
17-
1817
"react/jsx-no-duplicate-props": 2,
1918
"react/jsx-no-undef": 2,
2019
"react/jsx-uses-react": 2,
20+
"react/jsx-uses-vars": 2,
2121
"react/no-danger": 0,
2222
"react/no-unknown-property": 2,
2323
"react/self-closing-comp": 2,
@@ -28,6 +28,7 @@
2828
"env": {
2929
"node": true,
3030
"browser": true,
31-
"mocha": true
31+
"mocha": true,
32+
"es6": true
3233
}
3334
}

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DS_Store
2-
node_modules
3-
lib
4-
compiled
52
*.log
3+
dist
4+
lib
5+
node_modules

README.MD

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
<br>
2-
<p align="center"><a href="http://mjml.io" target="_blank"><img width="250"src="https://cloud.githubusercontent.com/assets/6558790/12672296/7b66d8cc-c675-11e5-805d-c6d196320537.png"></a></p>
32

43
<p align="center">
5-
<a href="https://travis-ci.org/mjmlio/mjml"><img src="https://travis-ci.org/mjmlio/mjml.svg?branch=master" alt="travis"></a>
6-
<a href="https://www.codacy.com/app/gbadi/mjml"><img src="https://api.codacy.com/project/badge/grade/575339cb861f4ff4b0dbb3f9e1759c35"/></a>
4+
<a href="http://mjml.io" target="_blank">
5+
<img width="250"src="https://cloud.githubusercontent.com/assets/6558790/12672296/7b66d8cc-c675-11e5-805d-c6d196320537.png">
6+
</a>
77
</p>
88

99
<p align="center">
10+
<a href="https://travis-ci.org/mjmlio/mjml">
11+
<img src="https://travis-ci.org/mjmlio/mjml.svg?branch=master" alt="travis">
12+
</a>
13+
<a href="https://www.codacy.com/app/gbadi/mjml">
14+
<img src="https://api.codacy.com/project/badge/grade/575339cb861f4ff4b0dbb3f9e1759c35"/>
15+
</a>
16+
</p>
17+
1018
<br>
11-
|
12-
<b><a href="#introduction"> Introduction </a></b>|
13-
<b><a href="#installation"> Installation </a></b>|
14-
<b><a href="#show-me-the-code"> Usage </a></b>|
15-
<b><a href="#contribute"> Contribute </a></b>|
1619

20+
<p align="center">
21+
| <b><a href="#introduction">Introduction</a></b>
22+
| <b><a href="#installation">Installation</a></b>
23+
| <b><a href="#show-me-the-code">Usage</a></b>
24+
| <b><a href="#contribute">Contribute</a></b> |
1725
</p>
26+
1827
<br>
1928

2029
---
@@ -24,6 +33,7 @@
2433
MJML is a markup language designed to reduce the pain of coding a responsive email. Its semantic syntax makes it easy and straightforward while its rich standard components library fastens your development time and lightens your email codebase. MJML’s open-source engine takes care of translating the MJML you wrote into responsive HTML.
2534

2635
<br>
36+
2737
<p align="center">
2838
<a href="http://mjml.io" target="_blank">
2939
<img width="75%" src="https://cloud.githubusercontent.com/assets/6558790/12450760/ee034178-bf85-11e5-9dda-98d0c8f9f8d6.png">
@@ -34,7 +44,7 @@ MJML is a markup language designed to reduce the pain of coding a responsive ema
3444

3545
# Installation
3646

37-
## Requirements:
47+
### Requirements
3848
- Node >= 4.2.x
3949

4050
<p>
@@ -45,10 +55,8 @@ MJML is a markup language designed to reduce the pain of coding a responsive ema
4555
</p>
4656

4757

48-
```
49-
58+
```bash
5059
npm install -g mjml
51-
5260
```
5361

5462
<a href="https://github.com/mjmlio/mjml/releases" target="_blank">
@@ -61,68 +69,89 @@ npm install -g mjml
6169
</a>
6270
</p>
6371

64-
6572
# Show me the code!
6673

6774
### Command line
6875

6976
> Compile the file and output the result in `a.html`
7077
71-
``` bash
72-
78+
```bash
7379
$> mjml -r input.mjml
74-
7580
```
7681

7782
> Redirect the result to a file
7883
79-
``` bash
80-
84+
```bash
8185
$> mjml -r input.mjml -o output.html
82-
8386
```
8487

8588
> Watch a file and compile every time the file changes
8689
87-
``` bash
88-
90+
```bash
8991
$> mjml -w input.mjml -o output.html
90-
9192
```
9293

93-
<br>
94-
### Inside NodeJs
94+
### Inside Node.js
9595

96-
``` javascript
97-
98-
import mjml from 'mjml'
96+
```javascript
97+
import { mjml2html } from 'mjml'
9998

10099
/*
101100
Compile an mjml string
102101
*/
103-
const htmlOutput = mjml.mjml2html(`<mj-body>
102+
const htmlOutput = mjml2html(`<mj-body>
104103
<mj-section>
105104
<mj-column>
106105
<mj-text>
107106
Hello World!
108107
</mj-text>
109108
</mj-column>
110109
</mj-section>
111-
</mj-body>
112-
`)
110+
</mj-body>`)
113111

114112
/*
115113
Print the responsive HTML generated
116114
*/
117-
console.log(htmlOutput);
115+
console.log(htmlOutput)
116+
```
117+
118+
### In your browser
119+
120+
```html
121+
<html>
122+
<head>
123+
<script src="dist/mjml.js"></script>
124+
<script>
125+
/*
126+
Compile an mjml string
127+
*/
128+
var htmlOutput = mjml.mjml2html('<mj-body>' +
129+
'<mj-section>' +
130+
'<mj-column>' +
131+
'<mj-text>' +
132+
'Hello World!' +
133+
'</mj-text>' +
134+
'</mj-column>' +
135+
'</mj-section>' +
136+
'</mj-body>')
137+
138+
/*
139+
Print the responsive HTML generated
140+
*/
141+
console.log(htmlOutput)
142+
</script>
143+
</head>
144+
<body>
145+
146+
</body>
147+
</html>
118148
```
119149

120150
### Create your component
121151

122152
> Issue the following in your terminal
123153
124-
``` bash
125-
154+
```bash
126155
$> mjml --init-component <name of your component>
127156

128157
# If your component cannot contain anything else than text:
@@ -135,8 +164,6 @@ $> mjml --init-component <name of you component> -e
135164
It will create a basic component template in a `.js` file. Follow the instructions provided in the file
136165
and read more about custom components in the documentation
137166

138-
<br>
139-
140167
# Try it live
141168

142169
Get your hands dirty by trying the MJML online editor! Write awesome code on the left side and preview your email on the right. You can also get the rendered HTML directly from the online editor.

bench/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var Benchmark = require('benchmark')
2+
var fs = require('fs')
3+
var mjml = require('../lib/index')
4+
var path = require('path')
5+
var template = fs.readFileSync(path.resolve(__dirname, './template.mjml')).toString()
6+
7+
var bench = new Benchmark('mjml2html', function () {
8+
mjml.mjml2html(template)
9+
}, {
10+
minSamples: 100,
11+
onComplete: function (e) {
12+
console.log(String(e.target))
13+
}
14+
})
15+
16+
bench.run()

0 commit comments

Comments
 (0)