-
Notifications
You must be signed in to change notification settings - Fork 392
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
CDN support #92
Comments
Would love to have this. Right now we're building the site and uploading new assets to CDN and then just loading them remotely during our snapshotting. However this introduces some other issues because I'd like to use Another potential enhancement that is somewhat different, but slightly related, would be to enable If you have any ideas on how to do this with the current version, would love to hear. Great work on the package! |
|
I'm very open on naming if that's what you meant... |
I mean it does not feel right. If something like this starts to appear it means that abstraction is wrong - either tool applied to wrong task or tool is wrong. If the original idea will fix your issue we should do that |
Yeah, I understand what you mean. It gets us close, however we also have a section of our site on the public facing area (that we are snapshotting) that loads content in from the Contentful CMS. So there is a case in which I want to allow some third party requests but not others. Potentially for my use case, I need to just allow third party requests and strip out the stripe.js loader during snapshotting, then add it back in to HTML afterwards. |
Thinking out loud. There is also Proposed It can also translate from "reactSnap": {
"cdn": {
"https://mysite.mycdn.com/assets": "build/assets", // url -> paht
"https://api.contentfull.com": true // url -> url
} But the name |
That could definitely work. Agree that I think the name |
Created a PR (#136) with the changes discussed. Happy to continue the discussion and make changes. |
It can happen that I over complicated the task. Maybe Related: |
Hello @stereobooster thank you for the library it really helps ! For this subject I just want to share with you a (bit dirty...) hack I found to be able to prevent some scripts from loading while ReactSnap is crawling <boby>
<div id="third-party-container"></div>
<script>
if (navigator.userAgent === 'ReactSnap') {
document.write('<textarea id="third-party">');
}
</script>
<script src="https://example.com/third-party-script.js"></script>
</textarea>
<script>
window.snapSaveState = () => {
document.getElementById('third-party-container').innerHTML =
document.getElementById('third-party').value;
}
</script>
</body> To explain a bit: The main idea is to condition the scripts with a So for the following cases: Local dev server Crawling with react-snap Snapshot built CaveatThe main issue is that your app built without |
Related: chrisvfritz/prerender-spa-plugin#114
config can look like:
And code can be like
The text was updated successfully, but these errors were encountered: