reacthtmlpack
v1.2.1 react html webpack
reacthtmlpack
Added the missing piece of treating
index.html
as entry point in webpack bundles.
Installation
npm install reacthtmlpack --save
I came here because I want to...
- Get started using
reacthtmlpack
immediately: go to [Getting Started](https://github.com/tomchentw/reacthtmlpack/blob/master/docs/Getting Started.md) - Ask myself if its necessary: see Who Should Use This
- Understand how to use
reacthtmlpack
in several projects: check out Different Examples from Simple to Complex - Understand the problem/solution: keep read on this
README.md
- Get in touch with the community: join Gitter Room
- File a bug or feature request: open an issue
The Problem
Added the missing piece of treating
index.html
as entry point in webpack bundles.
Slightly Long Version
When I tried to develop a static hosted website (e.g. gh-pages) using React and webpack, I found it annoying that webpack doesn't support index.html
as entry point natively. People feel the same way, too. They've developed many tools out there to approach the problem. However, all of them has certain pitfalls that doesn't match my needs:
- extracted css from js: common pattern for React application
- cache busting: generating hashed url to the compiled assets by webpack
- server rendering: rendering React component statically as part of html template
- server bundling: generating assets using
target: "node"
that will be used in server rendering
Read more about server bundling
Who Should Use This?
You have
- a static hosted website by a web server like nginx/apache.
- developed a react component and want to create a demo page for it on gh-pages
The Solution
Create a CLI
reacthtmkpack
that compiles html files into assets
- Use Babel, React, Webpack and Webpack-Dev-Server. All your favorite ones
- Write the
html
template using React (with Babel support). No other template library - Declare
<script>
or<link>
dependencies of your template using React Components - Simple and Explicit Command Line Interface
- HMR, react-hot-loader supported without hassle
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request