Conversation
|
I'm still not sure what exactly you'd like to be able to customise |
Instead of css modules, I use a CSS-in-JS library. As a result, I need the prerendering to output two strings, one for the HTML body and another for the styles. I've started using my forked solution. But anybody that uses js libraries for styles, regardless of which one, would have to do something similar. Otherwise the prerendered pages would have no styles at all. This is just one example of why prerendering can't fit into one-size-for-all solution. I wouldn't expect preact-cli to cover for all possible scenarios. My case is about styles, but I'm pretty sure others will have other needs. Extracting the process as a plugin is, in my opinion, the first step towards achieving customisation using the webpack |
|
While I do think we should support your use case I think we might want to do so at a different point, maybe make the ssr function itself customisable |
|
@ForsakenHarmony that's great to hear. The main point of this PR and the steps I tried to plan in #844 are already aimed in that direction. If this is something that the core team would prefer doing themselves, please also let me know so that I close this PR and carry on using my fork. |
What kind of change does this PR introduce?
It extracts
render-html-plugininto a separate package.Did you add tests for your changes?
These changes do not include any change in the logic of the application. This PR limits itself to move existing files into separate packages. I have tested the changes by creating and building an app using this version.
The only change in codebase is the currying of the plugin with a config object and the introduction of a
findlogic for the template file.If this PR looks ok to reviewers, I'm happy to add more tests.
Summary
The main goal for doing this is to allow more customisation of the prerender process as per #844
For final users, this PR does not change much as it doesn't expose an easy way to configure the plugin. I think this would be better addressed in a future PR, since this one already introduces some changes that I would like to have reviewed first:
util/webpack) into a separate package. This would require publishing this package.utilfile which now becomes a shared dependency between the mainclipackage and@preact/render-html-plugin. For this reason, I have also created a@preact/cli-utilpackage so that both can share the code. This would also require publishing the packageDoes this PR introduce a breaking change?
No
Other information
Please paste the results of
preact infohere.