diff options
author | Bryan Brattlof <bryanbrattlof@gmail.com> | 2019-01-13 10:24:19 -0600 |
---|---|---|
committer | Bryan Brattlof <bryanbrattlof@gmail.com> | 2019-01-13 13:22:11 -0600 |
commit | b141915cb947d93003cbf32071938c556ff20781 (patch) | |
tree | 8fb20c6ccf541f1046b49da71231eee7cd2660b8 | |
parent | 122828cf2724e6735572bb797f5a428b738c7a37 (diff) | |
download | pelican-htmlmin-b141915cb947d93003cbf32071938c556ff20781.tar.gz pelican-htmlmin-b141915cb947d93003cbf32071938c556ff20781.tar.bz2 |
use filter instead of if/continue statement0.1
-rw-r--r-- | __init__.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/__init__.py b/__init__.py index 50bf8a2..906b5a3 100644 --- a/__init__.py +++ b/__init__.py @@ -18,13 +18,10 @@ def run(pelican): options = pelican.settings.get('MINIFY', {}) htmlfile = re.compile(r'.html?$') pool = multiprocessing.Pool() - + + # find all html & htm files and give them to the workers to minify for base, dirs, files in os.walk(pelican.settings['OUTPUT_PATH']): - for f in files: - # filter only html files - if not htmlfile.search(f): - continue - # add full html path to wooker pool + for f in filter(htmlfile.search, files): filepath = os.path.join(base, f) pool.apply_async(worker, (filepath, options)) |