From f35a7b0e70032de2feec9f3bda09da44cf0e1073 Mon Sep 17 00:00:00 2001 From: srv Date: Mon, 28 Apr 2025 17:11:28 -0500 Subject: first commit --- plugins/compressor/compressor.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 plugins/compressor/compressor.py (limited to 'plugins/compressor/compressor.py') diff --git a/plugins/compressor/compressor.py b/plugins/compressor/compressor.py new file mode 100644 index 0000000..af2d704 --- /dev/null +++ b/plugins/compressor/compressor.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +""" +css-js-minify wrapper for Pelican +""" + +import glob + +from .minify import ( + process_single_css_file, + process_single_js_file, +) + +from pelican import signals + +CSS_DIR = '/theme/css' +JS_DIR = '/theme/js' + + +def main(pelican): + """ Compiler """ + for file in glob.iglob(pelican.output_path + CSS_DIR + '/**/*.css', recursive=True): + process_single_css_file(file, overwrite=True) + for file in glob.iglob(pelican.output_path + JS_DIR + '/**/*.js', recursive=True): + process_single_js_file(file, overwrite=True) + + +def register(): + """ Register """ + signals.finalized.connect(main) + + +SUPPORT_JS = """ +----------------------------------------------------------------- +COMPRESSOR: +----------------------------------------------------------------- +Future JavaScript support is orphan and not supported! +If you want to make ES6,ES7 work feel free to send pull requests. +----------------------------------------------------------------- +""" +print(SUPPORT_JS) -- cgit v1.2.3