Pelican's default Makefile
includes an option
make regenerate
which uses Pelican's
-r
/--autoreload
option to regenerate the site whenever a
file is modified. Combined with the Firefox extension Auto
Reload, this makes it easy to keep an eye on how a blog
post will be rendered as you author it and to quickly preview theme
changes.
The problem#
With just thirty articles, Pelican already takes several seconds to regenerate the site. For publishing a site, this is plenty fast, but for tweaking formatting in a blog post or theme, this is too slow.
The quick solution#
Pelican has an option, --write-selected
, which makes it only write out
the files listed. Writing just one file takes about half a second on my
computer, even though it still has to do some processing for all of the
files in order to determine what to write. To use --write-selected
,
you have to determine the output filename of the article you are editing:
$ pelican -r content -o output -s pelicanconf.py \
--relative-urls \
--write-selected output/draft/in-progress-article.html
The right solution#
Optimally, we wouldn't have to tell Pelican which file to output; instead, it would figure out which files could be affected by a change and regenerate only those files.