Closed Koooooo-7 closed 9 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
docsify-preview | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Dec 4, 2023 9:16am |
But it is not without preview. use cdn resources instead of lib.
Because we import the CND resources in index.html
.
I gonna update it.
It works with local resources
now.
Thanks for trying to fix this, @Koooooo-7.
Unfortunately, the changes in this PR fix the preview, but they will break https://docsify.js.org/ once published they are published.
The repo previously had two index files: ./index.html
and ./docs/index.html
. The one in the root directory loaded docsify files from /lib/
while the one in the ./docs
directory loaded files from a CDN. The Vercel preview loaded ./index.html
(local URLs) while docsify.js.org loaded ./docs/index.html
(CDN URLs). This worked, but there were a few issues:
index.html
files was confusing.index.html
in the root folder by having our local server (BrowserSync rewrite the CDN URLs to local URLs. You can see how this is done by viewing the new server configuration in that PR:The end result is one index.html
file that serves local files during local development and CDN files when served on docsify.js.org.
This PR simply hard-codes local URLs into the ./docs/index.html
file which (as stated above) fixes the preview but will break the live site once published.
Hope this explanation helps. :smile:
Hi @jhildenbiddle , I see.
I think the problem is the default github pages flow won't pre-build project, hence there is no /lib
resources folder.
If we accept the redirect way
to make the vercel
works, I think I could re-write the gitpage publish with custom github action ( pre-build the /lib
folder out ) to make the /doc/index.html
works as well.
Or instead, I rewrite the path to CDN
path in actions.
I could have a try on it.
If we accept the redirect way to make the vercel works, I think I could re-write the gitpage publish with custom github action ( pre-build the /lib folder out ) to make the /doc/index.html works as well. Or instead, I rewrite the path to CDN path in actions.
If we do that, we're just introducing a different version of the previous index.html
issue by having duplicate URL rewrite logic locally (BrowserSync) and in CI (GitHub actions).
A simpler way to accomplish the same thing:
/lib/
folder to /docs/
during the build process/docs/index.html
. I've explored a few options that solve the Vercel preview issue already. I think the above approach is best for a few reasons which I will outline in #2316 shortly. I will push these changes to that PR in the next few minutes.
If we do that, we're just introducing a different version of the previous
index.html
issue by having duplicate URL rewrite logic locally (BrowserSync) and in CI (GitHub actions).
A little concern here, I prefer to rewrite the path to CND when we wanna make publish to Pages work.
We need the local resources import in index.html
on PR/CI
pipeline to make vercel works and get the latest changes in files.
But on Publish-Pages, I think we don't need the local resources since we should use the CDN/released resource instead of a local build, although it should be the same since we always sync the latest release to the latest main commit.
(The rewrite is change the local import path to CDN @5
or @x
, we need not change the pipeline very frequently either. )
Generally, we keep only one index.html
with local resource import ( /docs/index.html
) , and remove the rewrite logic locally (BrowserSync). Then:
index.html
to make Publish-Pages work ------ add custom github pages action.WDYT?
Update:
The pages branch gh-pages for publish (GithubPages branch).
Github Action: deploy-gh
Rewrite result: index.html
(Copy /lib
action is similar operations)
@Koooooo-7 --
I've addressed the Vercel deployment issue in #2316.
Summary
Redirect output root path to
docs/index.html
since we remove the rootindex.html
under #2316 . If it is acceptable, we could merge it into #2316 and move on.Update: Custom github-pages publish flow to adapt
index.html
changes.Related issue, if any:
What kind of change does this PR introduce?
Repo settings
For any code change,
Does this PR introduce a breaking change?
No
Tested in the following browsers: