guard-jekyll-plus
guard-jekyll-plus copied to clipboard
handle _data files / dir?
does this handle files in the _data dir? jekyll doesn't seem to handle these so well, presumably because it doesn't know which templates depend on which data files. i was hoping for something that would just rebuild everything when a data file changes.
This plugin watches everything except changes in the output directory (usually _site):
https://github.com/imathis/guard-jekyll-plus/blob/master/lib/guard/jekyll_plus/config.rb#L95
So it does watch the data directory, but it depends how jekyll build responds.
Since jekyll doesn't know which data files affect which files, you can manually add "fake" guard triggers for each dependent file in your Guardfile, e.g.:
require 'guard/jekyll_plus/config'
jekyll_plus_options = {}
guard 'jekyll-plus', jekyll_plus_options do
watch(Guard::JekyllPlus::Config.new(jekyll_plus_options).watch_regexp)
watch('_data/stuff.yml') { ['src/foo.html', 'src/bar.html'].each { |f| system("touch", f } }
end
This may confuse your editor, but it's better than nothing.
Otherwise, Jekyll would have to have a "dependency" mode, where it processes a file and only lists dependencies (instead of actually processing the file).
oh wow, that's awesome. thanks!
@e2 i'm curious, have you seen your plugin used to make jekyll generate source maps? I've had some difficulty doing so — this issue explains why it's non-trivial
Hey, I've run into a similar issue when editing ruby files in the _plugins directory. I expect this has the same underlying cause of jekyll build not knowing which files to build.
Would it be possible to trigger a full jekyll build for certain files such as _data/* and _plugins/*?
I'm happy to take a stab at it if it seems like a good idea.