diff options
author | Jesús <heckyel@hyperbola.info> | 2019-11-11 19:20:50 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-11-11 19:20:50 -0500 |
commit | cb496623a44fcfe02471e9fe86fd028031fb0763 (patch) | |
tree | 2ecb1635fa7d158e19920139419e2b1e8c4d0223 | |
parent | dfad552ee0a6e5941f42f179734af43e5e6f72dc (diff) | |
download | cl-cb496623a44fcfe02471e9fe86fd028031fb0763.tar.lz cl-cb496623a44fcfe02471e9fe86fd028031fb0763.tar.xz cl-cb496623a44fcfe02471e9fe86fd028031fb0763.zip |
Remove NodeJS support
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | cl-theme/templates/authors.html | 5 | ||||
-rw-r--r-- | plugins/compressor/README.md | 8 | ||||
-rw-r--r-- | plugins/compressor/compressor.py | 31 |
4 files changed, 22 insertions, 31 deletions
@@ -19,15 +19,6 @@ los siguientes programas instalados: de la página. * [BeautifulSoup4](https://pypi.python.org/pypi/beautifulsoup4/). Requerido por el complemento tipue-search. -* [uglifycss](https://github.com/fmarcia/UglifyCSS). Compresor de código - <abbr title="Cascading Style Sheets">CSS</abbr>. -* [uglifyjs](http://lisperator.net/uglifyjs/). Compresor de código - JavaScript. -* [nodejs](https://nodejs.org/). Node.js® es un entorno de ejecución - para JavaScript construido con el motor de JavaScript V8 de Chrome. Se - utiliza para ejecutar uglifycss y uglifyjs. -* [npm](https://www.npmjs.com/). Gestor de paquetes de nodejs. Utilizado - para instalar uglifycss y uglifyjs. Instalar `virtualenv` con: diff --git a/cl-theme/templates/authors.html b/cl-theme/templates/authors.html index 1054070..c7c4129 100644 --- a/cl-theme/templates/authors.html +++ b/cl-theme/templates/authors.html @@ -53,14 +53,9 @@ {% set software = (('https://nginx.org/', 'Nginx'), ('http://babel.pocoo.org/', 'Babel'), ('https://pypi.org/project/beautifulsoup4/', 'BeautifulSoup4'), - ('https://nodejs.org/', 'nodejs'), ('https://www.python.org/', 'Python'), ('https://blog.getpelican.com/', 'Pelican'), ('https://pypi.org/project/Markdown/', 'Markdown'), - ('https://nodejs.org/', 'nodejs'), - ('https://www.npmjs.com/', 'npm'), - ('https://github.com/fmarcia/UglifyCSS', 'uglifycss'), - ('https://github.com/mishoo/UglifyJS', 'uglifyjs'), ('https://conocimientoslibres.tuxfamily.org/pages/librejs.html', _('Algunos programas de JavaScript'),)) %} <ul> {% for program in software %} diff --git a/plugins/compressor/README.md b/plugins/compressor/README.md index d7cc7d7..a3d4819 100644 --- a/plugins/compressor/README.md +++ b/plugins/compressor/README.md @@ -1,16 +1,16 @@ ## Descripción Es un complemento para Pelican que minifica los archivos CSS y -JavaScript usando uglifycss y uglifyjs. Preserva los archivos JavaScript +JavaScript usando css-html-js-minify. Preserva los archivos JavaScript originales y añade a los archivos JavaScript minificados la cadena `.min` antes de la extensión `.js`. ## Instalación -Para que funcione es necesario instalar nodejs y npm. Después instala -uglifycss y uglifyjs con la siguiente instrucción: +Para que funcione es necesario instalar python y pip. Después instala +css-html-js-minify con la siguiente instrucción: ``` -npm install uglifycss uglify-js -g +pip install css-html-js-minify ``` Finalmente, añade `compressor` a `pelicanconf.py`: `PLUGINS = diff --git a/plugins/compressor/compressor.py b/plugins/compressor/compressor.py index bd219d2..9d84dfe 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), + if os.path.splitext(name)[1] in '.css': + 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) |