reacts jsx テンプレート/コンポーネントを使用して静的サイト ジェネレーターを作成したいと思っています。これを可能にするために、ジキルとミドルマンをハッキングする必要がありました...
しかし、プラグインでhttp://www.metalsmith.ioを発見しました: https://github.com/yeojz/metalsmith-react-templates
私はこれまでにフォローしています:
var Metalsmith = require('metalsmith');
var reactTemplate = require('metalsmith-react-templates');
Metalsmith(__dirname)
.clean(true)
.use(reactTemplate({
directory: 'templates',
isStatic: true
}))
.source('src')
.destination('build')
.build(function(err) {
if (err) throw err;
});
および jsx ファイル:
var React = require('react');
var Entry = React.createClass({
render: function() {
return ();
}
});
module.exports = Entry;
node build.js を実行すると、エラーが発生します。
entry.jsx: Unexpected token
metalsmith-react-templates の例は時代遅れのようで、問題はありますか?
提案@を試しました:
4 | render: function() {
5 |
> 6 | return (<p>Entry</p>);
| ^
7 | }
8 | });
9 |