-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support pass all prerender-spa-plugin options #4
Comments
I am a bit against exposing the complete configuration to the file as it would effectively defeat the purpose of having a Vue CLI plugin in the first place, and introduce a lot of edge use cases that I'm not going to offer support for. Regarding your particular use-case of cleaning HTML of mutated DOM outside of Vue, you could mitigate the behavior two ways:
Another option would be to provide a collection of post-processing functions to run on demand. But that would most likely increase the number of options and I am not in favor of that. The last resort option would be a sort of "mega post-processing" function that automatically runs cleanup procedures when detecting issues with the HTML - but I don't know how feasible that would be. |
@SolarLiner I tried to add conditions on judging execute async scripts by detecting window['__PRERENDER_INJECTED'], but fails. After reading the implementation of Can we add more pass-down options in .prerender-spa.json? |
The I do realize now that you need the ìnject |
Thx for your replying, I missed the I just read a post: https://markus.oberlehner.net/blog/how-to-pre-render-vue-powered-websites-with-webpack/. I found that At present |
I'll add the ability to specify a file to run during post-processing in the configuration. It will execute the default export of that file. |
Version 1.1.0 - Adds support for user post-processing of HTML after pre-rendering #4 - Bundles an `app.html` file which is not prerendered, and should be used as entrypoint for non-prerendered routes #14 - Support multi-page mode (by @snadn) #10 (implementation #11) - Support non-default baseURL (by @snadn) #6 (implementation #9) - Writes configuration using the API `extendPackage` function, which writes to `vue.config.js`. If found, the old configuration will be copied over and converted on `vue invoke` (and read, but not converted on build).
Took me a while to work out how to use this. Might be worth adding something to the instructions page. For those looking to inject a value into the renderer I did it as follows: customRendererConfig: {
injectProperty: "__PRERENDER_INJECTED",
inject: {
test: "hi"
}
}, data can be found at |
The docs do say that I can however still add something in the README. |
@SolarLiner thank you for the work to add the postProcess option - super helpful, as is the plugin in general! 😀 |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
We can define more options which are feed to prerender-spa-plugin not only the renderer options in
.prerender-spa.json
.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Some async scripts write script tags into html and be rendered in pre-rendering. While user visit website these async scripts write twice thtese script tags.
prerender-spa-plugin
provides us postProcess option to cleanup the prerendered html. Need a way to configure that option.The text was updated successfully, but these errors were encountered: