diff options
author | Jesús <heckyel@hyperbola.info> | 2019-06-26 15:35:23 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-06-26 15:35:23 -0500 |
commit | a696a12f2c001c5be3b26ed1c4e21d4f8331f987 (patch) | |
tree | 7a7787facd1f9971608aab32313df09988223d35 /plugins | |
parent | 3cb4edbd55646f776e16ab9ce34473f2a748e689 (diff) | |
download | libretube-a696a12f2c001c5be3b26ed1c4e21d4f8331f987.tar.lz libretube-a696a12f2c001c5be3b26ed1c4e21d4f8331f987.tar.xz libretube-a696a12f2c001c5be3b26ed1c4e21d4f8331f987.zip |
remove NodeJS
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/compressor/compressor.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/plugins/compressor/compressor.py b/plugins/compressor/compressor.py index bd219d2..d877810 100644 --- a/plugins/compressor/compressor.py +++ b/plugins/compressor/compressor.py @@ -9,31 +9,36 @@ logger = logging.getLogger(__name__) # Display command output on DEBUG and TRACE SHOW_OUTPUT = logger.getEffectiveLevel() <= logging.DEBUG +PATH_CSS = 'output/theme/css/' +PATH_JS = 'output/theme/js/' """ Minify CSS and JS files in output path -with uglifycss and uglifyjs. +with css-html-js-minify. """ + + def minify(pelican): """ Minify CSS and JavaScript :param pelican: The Pelican instance """ - for dirpath, _, filenames in os.walk(pelican.settings['OUTPUT_PATH']): + for dirpathcss, _, filenames in os.walk(PATH_CSS): for name in filenames: if os.path.splitext(name)[1] in ('.css'): - filepath = os.path.join(dirpath, name) - logger.info('minifiy %s with uglifycss', filepath) - debug = '--debug' if SHOW_OUTPUT else '' - call('uglifycss {} --output {} {}'.format(debug, filepath, filepath), + filepath = os.path.join(dirpathcss, name) + logger.info('minifiy %s with css-html-js-minify', filepath) + call('css-html-js-minify {}'.format(filepath), shell=True) - elif os.path.splitext(name)[1] in ('.js'): - filepath = os.path.join(dirpath, name) - logger.info('minifiy %s with uglifyjs', filepath) - verbose = '-v' if SHOW_OUTPUT else '' - min_filepath = filepath[:-3] + '.min' + filepath[-3:] - call("uglifyjs {} {} -o {} --mangle".format(filepath, verbose, min_filepath), + + for dirpathjs, _, filenames in os.walk(PATH_JS): + for name in filenames: + if os.path.splitext(name)[1] in ('.js'): + filepath = os.path.join(dirpathjs, name) + logger.info('minifiy %s with css-html-js-minify', filepath) + call("css-html-js-minify {}".format(filepath), shell=True) + def register(): signals.finalized.connect(minify) |