bow-swift / nef

💊 steroids for Xcode Playgrounds
https://nef.bow-swift.io
Other
267 stars 6 forks source link

nef jekyll --watch #116

Open ferranpujolcamins opened 4 years ago

ferranpujolcamins commented 4 years ago

I usually write my docs on a swift playground while previewing the generated jekyll site in my browser.

I use jekyll serve, but I still to run nef jekyll manually in order for the generated markdown to be updated on a change.

I'd love a --watch option so nef automatically regenerates the markdown files for me.

miguelangel-dev commented 4 years ago

Ey @ferranpujolcamins, firstly, I appreciate your suggestions ^^ - thanks for coming to nef and give it a try!

About your suggestion, I agree it is a nice-to-have feature. Currently, I'm working on big refactor to migrate nef to a complete functional architecture using bow+swift. I comment about it because this refactor will help in future features like this one.

After the refactor, nef will provide APIs like


static func render(playgroundsAt: URL, 
                   mainPage: URL, 
                   into output: URL) -> IO<nef.Error, NEA<URL>>

Where IO<nef.Error, NEA<URL>> will be:

So you can easily call them to regenerate your Jekyll site. On a first review, we should investigate 2 things:

  1. How to subscribe to changes in any folder at mac-filesystem, so reactively we could invoke nef API after for example save any page (or playground)
  2. Let if we could invoke a refresh in the browser to auto-render the new content (prevent cache web-browser...) [maybe Jekyll server does it for us]

On this way, easily we could provide the option you suggest, whereafter any change in your playground it will regenerate your jekyll-site.

While I continue working on the refactor, if you want, you can investigate it... even add this option to jekyll-CLI when the refactor will be completed. (~mid of feb)

wdut?

Of course, when you start to work in the feature, I will provide u with any resource or help you need :)