Skip to content
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 proxy for napari.org #117

Merged
merged 2 commits into from
Jul 21, 2022
Merged

Add proxy for napari.org #117

merged 2 commits into from
Jul 21, 2022

Conversation

codemonkey800
Copy link
Collaborator

Adds a proxy server for https://napari.org. This allows us to serve the assets for napari.org in production, while using our local JS and CSS for styling. This allows us to test against existing bugs on napari.org that only impact the JS or CSS.

@jni
Copy link
Member

jni commented Jul 15, 2022

Would you mind summarising this in jargon-free language for non-web-devs? 😅 In the context of #113, I'd like the theme itself to be general and not contain references to napari.org — that should be some sort of configuration. For example, plugins might want to use the theme (I know some already do), so they would want to use a different URL presumably?

@codemonkey800
Copy link
Collaborator Author

codemonkey800 commented Jul 15, 2022

Would you mind summarising this in jargon-free language for non-web-devs? 😅 In the context of #113, I'd like the theme itself to be general and not contain references to napari.org — that should be some sort of configuration. For example, plugins might want to use the theme (I know some already do), so they would want to use a different URL presumably?

So essentially when accessing http://localhost:8080, instead of the local theme contents, it skips the local theme build and serves assets from https://napari.org like a proxy. Every file, except for the napari-sphinx-theme.js and napari-sphinx-theme.css files. These files are transpiled using our Webpack bundler and served dynamically as we make changes to the SCSS and TSX code. This allows us to fix JS and CSS specific issues while skipping the sphinx build step, effectively increasing start to dev time nearly 5x - 10x.

We can make the URL configurable though, I can pass it as an environment variable.

@codemonkey800
Copy link
Collaborator Author

codemonkey800 commented Jul 15, 2022

Alright I moved it to an env var, but keeping https://napari.org as the default so I don't have to pass it for every build. If someone wants to use this, they can run:

PROD_URL=https://example.com yarn dev:prod

@jni
Copy link
Member

jni commented Jul 16, 2022

Thanks! To clarify, this doesn't actually affect anything post-build, only during development, right?

@codemonkey800
Copy link
Collaborator Author

Thanks! To clarify, this doesn't actually affect anything post-build, only during development, right?

yep that's right! only for development

@codemonkey800 codemonkey800 merged commit dab5902 into main Jul 21, 2022
@codemonkey800 codemonkey800 deleted the jeremy/prod-server-proxy branch July 21, 2022 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants