-
Notifications
You must be signed in to change notification settings - Fork 111
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
How to build the __site locally and deploy on GitHub as a project? #816
Comments
I realized the answer was in the using Pkg; Pkg.activate("."); Pkg.instantiate();
using NodeJS; run(`$(npm_cmd()) install highlight.js`);
using Franklin;
import Franklin;
rm("__site", recursive=true, force=true);
Franklin.def_GLOBAL_VARS!();
Franklin.convert_md(read("config.md", String); isconfig=true);
optimize(prepath=Franklin.globvar(:prepath)); |
Unfortunately the highlight.js issue makes running using Pkg; Pkg.activate("."); Pkg.instantiate();
import Franklin;
if !Franklin.FD_CAN_HIGHLIGHT
# This whole bit exists simply because the constants in Franklin
# can't be updated even after highlight.js is installed
# e.g. /home/user/.julia
juliapath = pathof(Franklin);
juliapath = juliapath[1:findfirst("packages", juliapath)[1]-2];
Pkg.rm("Franklin");
rm("$(juliapath)/packages/Franklin", recursive=true, force=true);
rm("$(juliapath)/compiled/Franklin", recursive=true, force=true);
using NodeJS; run(`$(npm_cmd()) install highlight.js`)
Pkg.add("Franklin")
run(`julia build.jl`)
else
# Once highlight.js is installed
rm("__site", recursive=true, force=true);
Franklin.def_GLOBAL_VARS!();
Franklin.convert_md(read("config.md", String); isconfig=true);
Franklin.optimize(prepath=Franklin.globvar(:prepath));
end This is a pretty messy workaround that involves running a new instance of Julia from the shell. Considering that the issue's been raised since August it really needs to be fixed. Even if most people only intend to use Franklin for simple blogs and wouldn't mind rebuilding the site every time via a GitHub action, the whole point of Franklin is that it can embed Julia code, code that can become too cumbersome to be rebuilt on GitHub every time. |
Hello @yenson-lau I'm reopening as I just want to confirm a few things if you have the time:
I'm not 100% sure I follow the issue with highlight.js, is it an installation problem where Franklin tells you that it doesn't find the package? Thanks for the detailed reports in any case, it's very useful to get those even if I can be slow to fix things |
Hi @tlienart sure thing, happy to provide as much info as I can and thanks for checking in to this!
The highlight.js problem basically proceeds as follows
The reason for this is simply that the The quick and dirty fix is probably to try |
ok great I think both points can have quick fixes:
I'll check both these things as soon as I have some time :) |
I also find that serve() works locally, but online rendering with optimize doesn't work in the same way with my local katex functions. Making an alternative installation and operative system work with optimize() and online isn't as inspiring as it is time-consuming. I look forward to example 1, deploying the local files directly. |
@hustf in the meantime could you try disabling prerendering? So change the call to
|
Thank you for the tip. I retried that, but though I struggle with prerendering and NodeJS, that's less important in my case. I have a quite fragile setup for rendering the equations which is likely to be the problem. 'utils.jl' loads The gh-pages files contains, typically: Correct version, as rendered locally by functions defined in utils.jl: Screenshot from online version: Screenshot from local version: My current deploy.yml:
|
could you try
and report? (this will, in effect, be identical to your local setup unless you somehow have pinned versions of packages) failing that, would you mind adding me to the repo with your website so I can have a look? |
Done. The output can be confusing due to ad-hoc debug code from my parts, but the julia run ends like this:
I'll add you to the repository at once, and here's the last run. https://github.com/hustf/DEQ/runs/2793296994?check_suite_focus=true Also logging on to slack/Franklin. |
ok I think this is quite a different issue. I don't think it's related to OP (I'm not even sure it's Franklin). My hypothesis is just that there's a problem with The following is maybe not 100% satisfactory but should fix they issue and be more robust:
and then (I'd suggest opening another issue if you'd like to discuss this further as I don't think this is related to the path discussed in the rest of the thread). Ps: good stuff with all these hfuns, I'd be happy to have feedback in a separate issue if you wished there were additional things to help people develop and test those (e.g. to avoid what you stumbled upon) |
I think this is a very desirable feature. For example, if I generate some complex plots for my websites using a variety of Julia packages, I don't want GitHub to have to reinstall all the packages from scratch and rebuild the code every time. Instead I already have a completely built
__site
directory that should be directly deployable.The problem with the project page, of course, comes down to the
prepath
. Although I've set the prepath, removed__site
from my .gitignore, and ran the following code on my own computerand I've replaced my GitHub action as follows
I still couldn't get the site to deploy correctly. Is there any way for me to build the correct site on my own computer? Thanks!
The text was updated successfully, but these errors were encountered: