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

feat: use cdn url for static assets (#2281) #2283

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Conversation

zoomiti
Copy link
Contributor

@zoomiti zoomiti commented Feb 9, 2024

Closes #2281

@zoomiti
Copy link
Contributor Author

zoomiti commented Feb 9, 2024

me when i forgor to run cargo fmt

integrations/utils/src/lib.rs Outdated Show resolved Hide resolved
@gbj
Copy link
Collaborator

gbj commented Feb 9, 2024

Thanks, this looks great!

@zoomiti I recommended a small change in the comment above. The CI issues here are unrelated and I need to fix things up on main.

@CodingFlow could you let us know if this solves it for your use case? The approach here would be something like

CDN_PKG_PATH=https://my-cool-cdn.com/my-leptos-app/pkg cargo leptos build

i.e., including the CDN_PKG_PATH at compile time.

@zoomiti
Copy link
Contributor Author

zoomiti commented Feb 11, 2024

Wow it looks like CI is so big the container ran out of diskspace, at least for server_fn
Not sure what happened for select_stable

@CodingFlow
Copy link

Thanks, this looks great!

@zoomiti I recommended a small change in the comment above. The CI issues here are unrelated and I need to fix things up on main.

@CodingFlow could you let us know if this solves it for your use case? The approach here would be something like

CDN_PKG_PATH=https://my-cool-cdn.com/my-leptos-app/pkg cargo leptos build

i.e., including the CDN_PKG_PATH at compile time.

Yes, that looks it should do it for me. 👍

@gbj gbj merged commit 95bd9cc into leptos-rs:main Feb 16, 2024
56 of 60 checks passed
@gbj
Copy link
Collaborator

gbj commented Feb 16, 2024

Thanks very much!

@rakshith-ravi
Copy link
Collaborator

Okay. Small regression. What happens when my leptos app is not hosted at /? Let's say it's hosted at /ui?

The current code assumes / as the root regardless of what's given in the cargo.toml. Isn't this something we should fix?

@zoomiti
Copy link
Contributor Author

zoomiti commented Feb 16, 2024

The current code doesn't change any routing. All it does is make it so that static assets can be hosted on a CDN instead of on disk.

@gbj
Copy link
Collaborator

gbj commented Feb 16, 2024

@rakshith-ravi I don't think this changes anything — before the PR, the integration assumed the pkg directory is relative to /, always. Now, the integration assumes the pkg directory is relative to /, unless you specify a build-time env variable CDN_PKG_PATH.

I might be wrong, in which case if you open an issue with a reproduction of problem I'll look at it.

@rakshith-ravi
Copy link
Collaborator

rakshith-ravi commented Feb 16, 2024

before the PR, the integration assumed the pkg directory is relative to /, always

Ahh, got it. Then we shouldn't have an issue regression

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.

How to Use CDN Url for Static Assets When Deploying with SSR?
4 participants