Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
158 stars 44 forks source link

Add sync function #181

Closed Hysterelius closed 1 month ago

Hysterelius commented 1 month ago

I found when I was updating abridge, that my files would go out of date... leading to a few issues. So, I made a quick function to update all these out of date files.

I am more than happy if this too complex or not what you wanted, and you don't want to merge it.

This function currently does:


config.toml checking, using regexes. These two files would be evaluated to be the same:

# do NOT include a trailing slash on the base URL
base_url = "https://abridge.netlify.app"
# Usable site directly from disk, Including Search: "/home/jieiku/.dev/abridge/public"
# Also set index format = "elasticlunr_javascript", and in [extra] uglyurls = true, integrity = false
# If you use the npm/node script then all you have to do is set offline = true, and everything else is automatic.

title = "Abridge"
description = "Abridge is a fast and lightweight Zola theme using semantic html, abridge.css class-light CSS, and No Mandatory JS."
#theme = "abridge"

default_language = "en"
compile_sass = true
minify_html = true
build_search_index = true
generate_feeds = true
taxonomies = [
#    {name = "categories", feed = true},
    {name = "tags", feed = true},
]

and

# do NOT include a trailing slash on the base URL, and make sure to thank to awesome developer!
base_url = "https://abridge.pages.dev"
# Usable site directly from disk, Including Search: "/home/jieiku/.dev/abridge/public"
# Also set index format = "elasticlunr_javascript", and in [extra] uglyurls = true, integrity = false
# If you use the npm/node script then all you have to do is set offline = true, and everything else is automatic.

title = "A-tunnel"
description = "A-tunnel, it's just a big tunnel"
#theme = "abridge"

default_language = "de"
compile_sass = false
minify_html = false
build_search_index = false
generate_feeds = false
taxonomies = [
#    {name = "categories", feed = true},
    {name = "tags", feed = false},
]

However, it would fall apart if you were to comment out one of the already existing lines.

netlify[bot] commented 1 month ago

Deploy Preview for abridge ready!

Name Link
Latest commit e14dcf08a22b9a82598a671e1f32246027b853bf
Latest deploy log https://app.netlify.com/sites/abridge/deploys/669fd2858077370008b96426
Deploy Preview https://deploy-preview-181--abridge.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Jieiku commented 1 month ago

Great Idea! I am going to check this out and test it a bit once I get home from work!

Hysterelius commented 1 month ago

I have added a few more regexes, so the config.toml should be able to handle commented out lines of config and I have done some testing on my website's repo and it seems to be fine.

I was wondering if you wanted an option the config.toml or something, to disable sync?

Hysterelius commented 1 month ago

I added version checking in the sync script, so if it notices that the major version changes, which would signify breaking changes - which require an update for the package_abridge.js to work properly. image

Jieiku commented 1 month ago

Let me know when this is ready to go :)

Hysterelius commented 1 month ago

I am happy with it.

It depends if you want to sync any extra files or add any other sync checks. I am very busy at the moment, so I can't make any edits.

One thing is that if you don't run npm install when it prompts you to, it can't prompt you again (as the package.json file would already be updated).