yeojz / metalsmith-react-templates

A metalsmith plugin to render files using React / Preact / JSX based templates.
MIT License
92 stars 17 forks source link

Add .babelrc for examples and add dependencies to package.json #26

Closed pumpikano closed 8 years ago

pumpikano commented 8 years ago

First approaching the example, I would expect the following sequence to work, but it doesn't:

git clone https://github.com/yeojz/metalsmith-react-templates.git
cd metalsmith-react-templates/examples/
# replace line in package.json to install from registry: "metalsmith-react-templates": "^4.0.0"
npm install
npm install react react-dom babel-preset-react babel-preset-es2015
node build

There is some trouble with babel and after some non-obvious effort you can repair things, but difficulties arises from the fact that the example isn't independent from the module's build code. I think others run into trouble with the example as well (e.g. https://github.com/yeojz/metalsmith-react-templates/issues/19), so I think making it independent is worthwhile.

This PR gives the example its own .babelrc and makes all the build dependencies explicit in package.json. With these changes, the example builds even if you copied the directory out of this repo.

yeojz commented 8 years ago

:+1: Thanks!!