ChrisPenner / slick

Static site generator built on Shake configured in Haskell
BSD 3-Clause "New" or "Revised" License
204 stars 24 forks source link

Project updates #6

Closed sigrlami closed 5 years ago

sigrlami commented 5 years ago

Hi, Chris. This PR more condensed version of a previous one. It provides a basic outline for several improvements we have for Slick, built in collaboration with @mgajda. Overall changes striped down to 14 files.

This PR includes: 1) Addition of Serve.hs preview module, that provides functionality for Preview mode. Spins out small server locally for site observation. Additionally, taking into account your previous suggestions. All its functionality moved to slick-live package in case you have a strong opinion to not include this functionality.

2) Initial integration with our shake-watch project that will be released soon which provides continuous rebuilds on either haskell changes or site changes. Revealed in example, tightly coupled with Preview mode. My thinking when preview mode running, it should be in live reload version, so our watcher starts automatically. More explicit functionality will be available soon when the package is published.

3) Addition of Build.hs file that includes high-level goodies we created while working on multiple sites

 3.1) Shake builder that always prune stalled files `shakeArgsPruneAlwaysWith`. Small note here, there is `shakeArgsPruneWith`  available, a standard function that accepts `--prune` option for cleanups, when working with web-content that should default function so the user always has the correct version of the site. Having all the time `--prune` to run a little tedious, so we embed this functionality. Library user always can easily fall back to other options

 3.2) Default Markdown and Pandoc options moved out of the library. Forcing user to specify one and provide to a builder. 

4) Updates example project 4.1) Additional keys 4.2) Additional Builder.hs file with everything related to builds and update to the main workflow where shakeRules and builder moved to separate functions for further reuse.

Looking forward to your feedback!

mgajda commented 5 years ago

t's reasonable to have the more advanced options available of course, but the 'default' so-to-speak should always just "do the right thing", so I've left quite a few comments to that effect.

With regards to slick-live this seems to be the right thing to do out-of-the-box, even though it does some magic behind the scenes. Maybe we should add comment on how to add slick-live to example/?

sigrlami commented 5 years ago

@ChrisPenner Thank you very much for your package and so quick review! I can address some issues already:

  1. Add more thorough documentation on functions
  2. Move out serving functionality completely for slick-live
  3. Update Readme with examples on slick-live

I'll work out other points when I have your responses.

sigrlami commented 5 years ago

Quick update, slick-live removed completely to separate repo, no related dependencies for it in Slick package. Example package contains dependency to slick-live if we still want to show how to use it.

ChrisPenner commented 5 years ago

Sorry, I've been sick with the flu for about a week so haven't had much time for this, but I'll get to it ASAP once I start feeling better :+1:

sigrlami commented 5 years ago

@ChrisPenner no problem, get well!

sigrlami commented 5 years ago

@Chris Based on recent discussions. We'll move extra code to separate package that will contain additional goodies like universal loaders, keeping upstream dense.

Last commit:

ChrisPenner commented 5 years ago

Looks great thanks! I think the only thing left before a merge is removing fmapFmapOptDescr from external exports by either moving Utils to an Internal module, or just copy-pasting it next to its internal use; also if you could export getDirectoryPaths from Slick that'd be great, then I'd be more than happy to merge and release!

Thanks for being patient :) It's always tough and frustrating to work through large PRs like this 😄

Feel free to add a link to slick-live or whatever in the README too! It'd be great if people knew about it!

ChrisPenner commented 5 years ago

If you're interested in adding more helpers upstream I'd be more than happy to talk about it in smaller PRs; it's just tough to handle everything at once 😄

sigrlami commented 5 years ago

Hi, Chris. Thank you for a very quick review. Last commit corrects those few bits based on your request.

Regarding PR size this is my fault and I'll try to keep updates coming in a smaller forms so you can review them easily.

If it's ok I would like to create another PR with README updates where I can explain how to use live and links to extra package and when advanced users might require them.

ChrisPenner commented 5 years ago

Sounds good, thanks!

srid commented 5 years ago

Initial integration with our shake-watch project that will be released soon which provides

Has shake-watch been released already?

sigrlami commented 5 years ago

@srid repo already public https://gitlab.com/migamake/shake-watch and will be released to hackage/stackage soon, as we finish polishing and preparations (there will be accompanying article).