-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --static flag to build script which allows to generate static html for specific routes #642
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…l for specific routes
oh, please, accept this :) |
This was referenced May 13, 2016
A question: is it possible to generate static version so that index.html gets generated as well? |
const routes = [
'/', // => build/public/index.html
'/page', // => build/public/page.html
'/page/', // => build/public/page/index.html
'/page/name', // => build/public/page/name.html
'/page/name/', // => build/public/page/name/index.html
]; |
hackhat
pushed a commit
to hackhat/react-starter-kit
that referenced
this pull request
Sep 5, 2016
…iguration has a new key named `serverSideRendering` that can be toggled between `true` and `false`. Related to: kriasoft#642, kriasoft#634
hackhat
pushed a commit
to hackhat/react-starter-kit
that referenced
this pull request
Sep 5, 2016
…iguration has a new key named `serverSideRendering` that can be toggled between `true` and `false`. Related to: kriasoft#642, kriasoft#634
hackhat
pushed a commit
to hackhat/react-starter-kit
that referenced
this pull request
Sep 5, 2016
…iguration has a new key named `serverSideRendering` that can be toggled between `true` and `false`. Related to: kriasoft#642, kriasoft#634
@frenzzy what about the routes that have params? |
You can specify the same route multiple times with all available params manually const routes = [
// ...
'/product/iphone-7', // => build/public/product/iphone-7.html
'/product/iphone-7/specs', // => build/public/product/iphone-7/specs.html
'/product/galaxy-note-7', // => build/public/product/galaxy-note-7.html
'/product/galaxy-note-7/specs', // => build/public/product/galaxy-note-7/specs.html
// etc.
]; Or you can dynamically build such routes based on list of params from api or somewhere else async function render() {
let server;
await new Promise(resolve => (server = runServer(resolve)));
// add dynamic routes
const products = await fetch(`http://${host}/api/products`).then(res => res.json());
products.forEach(product => routes.push(
`/product/${product.uri}`,
`/product/${product.uri}/specs`
));
await routes.reduce(/* ... */);
server.kill('SIGTERM');
} |
Closed
This was referenced Jul 30, 2020
This was referenced Jan 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #61 #73 #156 #260 #634 #635