Fork me on GitHub
#cryogen
<
2020-10-28
>
dorab01:10:41

I liked your approach of adding start-watcher-for-changes! to handle more-than-zero argument callbacks.

👍 3
Jakub Holý (HolyJak)06:10:12

I have been thinking about a non-inconsistent incremental compilation but I am afraid it would make the code unnecessarily complex. I we simply filter out unchanged posts/pages - which will also affect tags, archives, etc. So I would need not to remove them but keep them but without the parsed content and only later, when they are written, skip that if there is no content. So it is doable but it goes against the current assumptions in the code and could be confusing and a potential source of bugs. So unless people insist it is essential, I would prefer this simple and dirty solution, that requires a full build before publication. I now print this at the end of compilation, in yellow: > generating filtered rss > --> /cryogen.xml > BEWARE: Incremental compilation, things are missing. Make a full build before publishing. > "Elapsed time: 1314.637696 msecs"

dorab16:10:37

The warning is a good compromise. From my limited knowledge, it seems to me that there are 3 disjoint kinds of changes on a page: (1) Only "normal" textual content. Just changing the words on the page. In that case, just recompiling that one page should leave everything consistent. (2) changes in tags. That should only need recompilation of the page and the tags page(s). (3) Linking content (e.g., date, title, file name or URL) changes. All these changes potentially impact how that page is referenced from other pages. In this case, it is likely necessary to find out all the other pages that reference this page and recompile them as well. If I've missed other kinds of changes, or there are flaws in my reasoning, please let me know. If we can easily determine whether the changes are of type (1) or (2) then we can do a limited recompilation and still be consistent. For now, if the changes are type (3) changes, we just recompile everything. That should handle the most common cases of just changing the page content or tags, and still keep the whole in a consistent state. The key, obviously, is whether there is an easy way within the current code of determining whether the change is of type (1) or (2). I don't know enough to say.

❤️ 3
Jakub Holý (HolyJak)17:10:56

It certainly is possible. But is it necessary? The only reason I see for the incremental compilation when you are working on a single page / post (ie type 1 change) with frequent changes and want to see those ASAP. The goal here is not a complete, flawless result (build) but quick feedback on the "unit under work". In other words, it is a development utility, not a faster publication tool.

👍 3
Jakub Holý (HolyJak)18:10:28

@carmen can we perhaps get ☝️ merged as is, as a minimal implementation, and improve the algorithm if necessary based on real-world feedback?

seancorfield18:10:28

Just switched http://corfield.org over from Octopress/Jekyll to Cryogen and I'm loving it so far. I noticed the default RSS feed is feed.xml -- because someone complained that I used to have atom.xml on my old site -- so I changed :rss-name to "atom.xml" but then I wondered about the format... looking at the generated file, it does appear to be RSS2/Atom anyway (good). Is there a reason that the default :rss-name is "feed.xml"?

seancorfield18:10:44

Also, it would be great if certain parts of the site could be excluded from the sitemap.xml (I have a bunch of legacy HTML content that is linked from other sites that I don't want indexed otherwise). I guess I could add a robots.txt file manually but it would be nice to have Cryogen omit certain directories from the sitemap.xml -- it currently just uses :ignored-files but changing that would affect other parts of Cryogen and also the code only ignores files by .getName so any directories are not considered. Any suggestions for how best to approach that? Override parts of Cryogen locally by copying namespaces, submit a PR to make this more configurable?

seancorfield19:10:22

(so this channel will get mirrored to Zulip Clojurians -- unless anyone objects?)

👍 6
carmen19:10:30

@holyjak sounds good to me. Btw I was wondering if you know how to pass extra args to the lein-ring plugin? I was thinking it might be nice to put this feature behind a flag. Personally, I don't need faster compilation because I don't blog very much. I looked around the lein-ring docs and code and I couldn't find a way to do this.

Jakub Holý (HolyJak)19:10:19

I don't. An option are env variables. But existing users will not be affected and new ones may simply replace start-watcher-for-changes! with start-watcher! to opt out. Why would you use serve anyway if not only while writing a post? Notice that the first serve always build everything, as does simple run

carmen14:10:51

Good point. I'm fine leaving it as is then

👍 3
carmen19:10:31

@seancorfield happy to hear the positive feedback! Hopefully the migration was relatively painless? > Is there a reason that the default :rss-name is "feed.xml"? There's is no reason... 🙂 Re: sitemap stuff I'd go with the "make this more configurable" route. The change should be straightforward (new key in config.edn, etc)

seancorfield19:10:15

Since the sitemap generation relies on find-assets and ignore, it seems like quite a bit of the plumbing would need to be touched.

carmen19:10:57

Oh really? Clearly I haven't looked at the code in a while 😅

seancorfield19:10:56

Well, I guess sitemap/generate could just filter the result of find-assets which would avoid pushing changes further down the tree...

carmen19:10:20

Yeah, the filtering doesn't necessarily have to happen inside find-assets

seancorfield19:10:47

I'll set up a PR for discussion, if that's ok @carmen?

❤️ 3
Jakub Holý (HolyJak)20:10:35

FYI for the asciidoctor users out there, I am going to add support for asciidoctor macros - you will register in config.edn :asciidoctor :macros <name> <macro fn symbol>.

❤️ 3