jdan / cleaver

30-second slideshows for hackers
http://jdan.github.io/cleaver
MIT License
4.03k stars 305 forks source link

Feature: watch local themes, stylesheets and templates for changes #128

Open neelabhg opened 9 years ago

neelabhg commented 9 years ago

cleaver watch should rebuild on changes to a template, style, or any file included as part of a theme. I know #120 added support for watching stylesheets if passed with --style arg, but this should be implemented for files mentioned in the YAML front matter as well.

This will not be feasible for themes pulled from remote repositories, but we can check if the theme is in a local directory, and then watch every theme-related file for changes.

wuleninja commented 7 years ago

Yeah, that would be a very nice addition.

In the meantime, I'm using chokidar-cli to watch for all the changes, and restart the generation.

sudodoki commented 7 years ago

@ninjawule can you share, please, command you are using for others to reference?

wuleninja commented 7 years ago

Yup, I'm using chokidar-cli like this:

chokidar 'my_folder/my_doc.md' 'my_folder/my_doc.css' --initial --silent \
-c 'cleaver --debug my_folder/my_doc.md --title "My HTML Title" --output my_folder/my_doc.html --theme jdan/cleaver-retro --style my_folder/my_doc.css'

With chokidar, I'm monitoring the MD file, but also the CSS file, and when one of them changes, the command given with the -c option is run.

The tradeoff for doing this is that the live reload does not seem to work anymore. Maybe I should try letting the "watch" option in the cleaver command, I don't know.

But I prefer reloading my browser rather than killing the cleaver process to restart it each time I change my CSS, which happens quite a lot in my case.

sudodoki commented 6 years ago

There's a PR that does some of this in #161

neelabhg commented 6 years ago

Thank you, please feel free to close this issue once that PR is merged.