Feature request: more granular skipping with user-supplied filter function
==========================================================================
Currently Frozen-Flask either regenerates all files, or skips all existing files when `FREEZER_SKIP_EXISTING` is set to `True`. This poses a difficulty when part of the site is slow to generate but only needs to be generated once, while the rest of the site changes all the time (see example app below). It would be nice to be able to supply a filter function `skip(url, path) -> bool` to decide whether to skip a URL.
Please excuse me if this functionality is already possible.
---
Example app: Each day a new page for that day is added; this page is expensive to generate, but its content is fixed once generated. The index needs to be regenerated every time a new page is added. The whole site takes minutes to generate, but it really should take ~1s to generate what's new or changed.
```py
#!/usr/bin/env python3
import datetime
import time
import flask
app = flask.Flask(__name__)
INDEX_TEMPLATE = '''\
<html>
<head><title>Days</title></head>
<body>
<ul>
{% for date in dates -%}
<li><a href="{{ url_for('day', date=date) }}">{{ date }}</a></li>
{% endfor -%}
</ul>
</body>
</html>
'''
@app.route('/')
def index():
date = datetime.date(2017, 1, 1)
dates = []
while date <= datetime.date.today():
dates.append(str(date))
date += datetime.timedelta(1)
return flask.render_template_string(INDEX_TEMPLATE, dates=dates)
@app.route('/<date>.txt')
def day(date):
time.sleep(1)
return flask.Response(date, mimetype='text/plain')
if __name__ == '__main__':
app.run(debug=True)
```
A simple filter function would solve the problem:
```py
def skip(url, path):
return url.endswith('.txt') and os.path.exists(os.path.join('build', path))
```