diff --git a/.gitignore b/.gitignore index 876553f..59546fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules dist/* !dist/app.js +!dist/assets .idea vendor diff --git a/README.md b/README.md index 9acd1a8..2e456b3 100644 --- a/README.md +++ b/README.md @@ -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: ``` -node cli --type= --payload= +node cli --type= --payload= [--assetsHost=] [--locale=be] ``` Try `php example.php` for demo. diff --git a/package.json b/package.json index 6fca359..bf7bd9d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "image-size-loader": "^0.7.0", "json-loader": "^0.5.4", "scripts": "file:scripts", - "url-loader": "^0.5.7", "webpack": "^1.12.9", "webpack-dev-server": "^1.14.0", "webpack-utils": "file:webpack-utils" diff --git a/src/index.js b/src/index.js index 78493e1..5819288 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,12 @@ if (process.env.NODE_ENV !== 'production') { module.exports = { default(props) { + if (props.assetsHost) { + __webpack_public_path__ = props.assetsHost.replace(/\/*$/, '/'); // eslint-disable-line + + Reflect.deleteProperty(props, 'assetsHost'); + } + return ReactDOMServer.renderToStaticMarkup( diff --git a/webpack.config.js b/webpack.config.js index 5285f91..13225dc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -68,9 +68,9 @@ const webpackConfig = { }, { test: /\.(png|gif|jpg|svg)$/, - loader: 'url', + loader: 'file', query: { - name: 'assets/[name].[ext]?[hash]' + name: 'assets/[name]-[folder].[ext]?[hash]' } }, {