cleaver icon indicating copy to clipboard operation
cleaver copied to clipboard

Feature: watch local themes, stylesheets and templates for changes

Open neelabhg opened this issue 9 years ago • 5 comments

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.

neelabhg avatar Nov 05 '15 01:11 neelabhg

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.

wuleninja avatar Feb 10 '17 14:02 wuleninja

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

sudodoki avatar Feb 10 '17 16:02 sudodoki

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.

wuleninja avatar Feb 10 '17 16:02 wuleninja

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

sudodoki avatar Dec 03 '17 14:12 sudodoki

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

neelabhg avatar Dec 21 '17 15:12 neelabhg