Enabling export.css
mklilley opened this issue Β· comments
Hello and thank you so much for making this Github action. I followed your instructions and got some lovely github pages from my Logseq notes.
The one thing I couldn't get to work is export.css
styles.
Here is how it is supposed to work:
If you have styles in a file called export.css
(inside the same folder as custom.css
) then, when you come to export the graph, logseq uses the styles inside of export.css
instead of custom.css
. I've tried this myself using a local desktop app and it works for me. It means I can have custom styles while editing and export styles for exporting.
In my repo, I've committed the export.css
file but it seems that the Github action isn't picking it up.
Any idea why that might be?
Thanks
PS. here is my workflow.
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Logseq Publish π©
uses: pengx17/logseq-publish@main
with:
version: master
- name: add a nojekyll file
run: touch $GITHUB_WORKSPACE/www/.nojekyll
- name: Deploy π
uses: JamesIves/github-pages-deploy-action@4.1.9
with:
branch: gh-pages # The branch the action should deploy to.
folder: www # The folder the action should deploy.
The reason is because by default the Logseq version (when you specify version: master
in the pengx17/logseq-publish field) being used in this action is outdated and does not support export.css
which is introduced in a later version.
In the mean time, if you would want to use the action to publish your graph, you can move the contents of export.css to custom.css, which should work normally.
I would like to update the Logseq version sometime in the near future, but I cannot make a promise if I have the time though π
Thanks for getting back to me @pengx17 . After doing a bit of digging I also realised export was a recent thing. I completely appreciate that you might not have time to update the Action and I want to thank you again for making this version - it's great.
If you have a little time (or anyone else who sees this) I'd appreciate your thoughts on what goes wrong when one tries to use the action with Logseq version 0.7.1. In other words, what goes wrong when you set the workflow yaml file to have:
- name: Logseq Publish π©
uses: pengx17/logseq-publish@main
with:
version: 0.7.1
I tried it this morning and it doesn't work but can't quite see an obvious reason why.
I checked out the playwright trace using https://trace.playwright.dev/ as you advised (trace zip available here https://github.com/mklilley/Bhatia/blob/gh-pages/trace.zip) and everything seems to go fine. It just seems to hang. The hanging is consistent with the logs which say export timeout
It does seem to be trying to checkGraphDistPathExist
a lot. I took a look at publish.mjs
to have a little geek out. Presumably it's failing because this line https://github.com/pengx17/logseq-publish/blob/main/publish.mjs#L87 is always evaluating to false? i.e.:
if (
distPathExists ||
(graphDistPath &&
fs.statSync(path.join(graphDistPath, "static")).isDirectory())
)
Is it obvious why that would be the case? Happy to do some more digging myself.... i just don't want to go on a wild goose chase.
Hi, please try version: nightly
which is built two days ago.
Thanks for the advice @Xuanwo . I just tried it and have the same problem :-(
Ok, I've narrowed it down a bit now.
From the pic in the last post you can see on line 113 that graphDistPath
is defined because Trace file was successfully saved and that variable is required to export the Trace (as you can see on line 173 and line 210)
That suggests that it really is this line
fs.statSync(path.join(graphDistPath, "static")).isDirectory())
from line 87 that's going wrong.
What do you think?
I'm a bit confused. Can you try cp export.css custom.css
before publishing, so that we can make sure our graph && setups are working?
Hello again @Xuanwo . I'm happy to try but I'm not sure that I understand. Are you worried that I've not got a custom.css
file? Here is the repo https://github.com/mklilley/Bhatia where you can see the export.css and custom.css inside of logseq folder
Are you worried that I've not got a
custom.css
file?
I forked the project here: https://github.com/Xuanwo/Bhatia
I'm guessing the latest version of logseq publishing feature is broken if export.css
exists.
Before @pengx17 addresses the root cause, please use a workaround to fix this:
mv export.css custom.css
Thanks for the workaround @Xuanwo .
I created a new repo without export.css
and using nightly
. I get the same errors.
See https://github.com/mklilley/test
So, it seems like it's not a problem with export.css
So, it seems like it's not a problem with
export.css
Your conclusion is correct. nightly
is broken entirely. Maybe logseq
updated the UI layout that logseq-publish
depends on.
I spend some time today and it looks like the issue is related to an issue upstream. See my fix in logseq/logseq#5997
The issue should have been fixed. Please try again with master
version. Your graph should be exported normally and use export.css
instead of custom.css
.
Amazing - it works. Thanks so much @pengx17
I believe the issue has been fixed. Closing