mirror of
https://github.com/elyby/emails-renderer.git
synced 2024-12-23 13:49:48 +05:30
Use files instead of data uri. Added option to define assetsHost
This commit is contained in:
parent
fcc5d024cc
commit
14e84d4172
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist/*
|
dist/*
|
||||||
!dist/app.js
|
!dist/app.js
|
||||||
|
!dist/assets
|
||||||
.idea
|
.idea
|
||||||
vendor
|
vendor
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
This package allows rendering of React components into plain HTML to use it in emails. Each directory in `emails` dir corresponds to separate email template. Each email component will receive payload, passed from command line:
|
This package allows rendering of React components into plain HTML to use it in emails. Each directory in `emails` dir corresponds to separate email template. Each email component will receive payload, passed from command line:
|
||||||
|
|
||||||
```
|
```
|
||||||
node cli --type=<email_dir_name> --payload=<json_encoded_in_base64>
|
node cli --type=<email_dir_name> --payload=<json_encoded_in_base64> [--assetsHost=<scheme://host:port>] [--locale=be]
|
||||||
```
|
```
|
||||||
|
|
||||||
Try `php example.php` for demo.
|
Try `php example.php` for demo.
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
"image-size-loader": "^0.7.0",
|
"image-size-loader": "^0.7.0",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"scripts": "file:scripts",
|
"scripts": "file:scripts",
|
||||||
"url-loader": "^0.5.7",
|
|
||||||
"webpack": "^1.12.9",
|
"webpack": "^1.12.9",
|
||||||
"webpack-dev-server": "^1.14.0",
|
"webpack-dev-server": "^1.14.0",
|
||||||
"webpack-utils": "file:webpack-utils"
|
"webpack-utils": "file:webpack-utils"
|
||||||
|
@ -22,6 +22,12 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
default(props) {
|
default(props) {
|
||||||
|
if (props.assetsHost) {
|
||||||
|
__webpack_public_path__ = props.assetsHost.replace(/\/*$/, '/'); // eslint-disable-line
|
||||||
|
|
||||||
|
Reflect.deleteProperty(props, 'assetsHost');
|
||||||
|
}
|
||||||
|
|
||||||
return ReactDOMServer.renderToStaticMarkup(
|
return ReactDOMServer.renderToStaticMarkup(
|
||||||
<Html>
|
<Html>
|
||||||
<App {...props} />
|
<App {...props} />
|
||||||
|
@ -68,9 +68,9 @@ const webpackConfig = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|gif|jpg|svg)$/,
|
test: /\.(png|gif|jpg|svg)$/,
|
||||||
loader: 'url',
|
loader: 'file',
|
||||||
query: {
|
query: {
|
||||||
name: 'assets/[name].[ext]?[hash]'
|
name: 'assets/[name]-[folder].[ext]?[hash]'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user