iansinnott / iansinnott/react-static-webpack-plugin
Dynamic Routes
- Dominant language
- JavaScript
- Stars
- 155
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
AKA routes that look like
``` js
```
## The issue
We need dynamic routes to support creating an entire category of sties including blogs. However currently we don't have a way to turn something like `posts/:id` into a file directly. Normally we would have something like this:
```
posts/
hellow-world.md
second-post.md
still-here.md
```
Which would generate the following HTML...
```
posts/
hello-world.html
second-post.html
still-here.html
```
But in our case React Router has no way of knowing the contents of our `posts/` directory so how would it know what files to generate?
Most static site generators would read the `posts/` directory and then generate static sites from those files. However, that requires the user to either learn how to configure their generator or learn the conventions for creating dynamic content.
We could do the same thing:
``` js
fs.readdirSync('./posts').forEach(filename => {
// 1. Read contents of file
// 2. Generate a static HTML file for it
});
```
But then the user would have to know how to hook into this process. It is a first-class goal of this project to not force the user to learn some new technology. Just add this plugin to a webpack config and go. This is the issue I'd like to solve.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.