Remove NodeJS support
This commit is contained in:
parent
dfad552ee0
commit
cb496623a4
@ -19,15 +19,6 @@ los siguientes programas instalados:
|
|||||||
de la página.
|
de la página.
|
||||||
* [BeautifulSoup4](https://pypi.python.org/pypi/beautifulsoup4/).
|
* [BeautifulSoup4](https://pypi.python.org/pypi/beautifulsoup4/).
|
||||||
Requerido por el complemento tipue-search.
|
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:
|
Instalar `virtualenv` con:
|
||||||
|
|
||||||
|
@ -53,14 +53,9 @@
|
|||||||
{% set software = (('https://nginx.org/', 'Nginx'),
|
{% set software = (('https://nginx.org/', 'Nginx'),
|
||||||
('http://babel.pocoo.org/', 'Babel'),
|
('http://babel.pocoo.org/', 'Babel'),
|
||||||
('https://pypi.org/project/beautifulsoup4/', 'BeautifulSoup4'),
|
('https://pypi.org/project/beautifulsoup4/', 'BeautifulSoup4'),
|
||||||
('https://nodejs.org/', 'nodejs'),
|
|
||||||
('https://www.python.org/', 'Python'),
|
('https://www.python.org/', 'Python'),
|
||||||
('https://blog.getpelican.com/', 'Pelican'),
|
('https://blog.getpelican.com/', 'Pelican'),
|
||||||
('https://pypi.org/project/Markdown/', 'Markdown'),
|
('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'),)) %}
|
('https://conocimientoslibres.tuxfamily.org/pages/librejs.html', _('Algunos programas de JavaScript'),)) %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for program in software %}
|
{% for program in software %}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
## Descripción
|
## Descripción
|
||||||
|
|
||||||
Es un complemento para Pelican que minifica los archivos CSS y
|
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
|
originales y añade a los archivos JavaScript minificados la cadena
|
||||||
`.min` antes de la extensión `.js`.
|
`.min` antes de la extensión `.js`.
|
||||||
|
|
||||||
## Instalación
|
## Instalación
|
||||||
|
|
||||||
Para que funcione es necesario instalar nodejs y npm. Después instala
|
Para que funcione es necesario instalar python y pip. Después instala
|
||||||
uglifycss y uglifyjs con la siguiente instrucción:
|
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 =
|
Finalmente, añade `compressor` a `pelicanconf.py`: `PLUGINS =
|
||||||
|
@ -9,31 +9,36 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
# Display command output on DEBUG and TRACE
|
# Display command output on DEBUG and TRACE
|
||||||
SHOW_OUTPUT = logger.getEffectiveLevel() <= logging.DEBUG
|
SHOW_OUTPUT = logger.getEffectiveLevel() <= logging.DEBUG
|
||||||
|
PATH_CSS = 'output/theme/css/'
|
||||||
|
PATH_JS = 'output/theme/js/'
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Minify CSS and JS files in output path
|
Minify CSS and JS files in output path
|
||||||
with uglifycss and uglifyjs.
|
with css-html-js-minify.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def minify(pelican):
|
def minify(pelican):
|
||||||
"""
|
"""
|
||||||
Minify CSS and JavaScript
|
Minify CSS and JavaScript
|
||||||
:param pelican: The Pelican instance
|
: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:
|
for name in filenames:
|
||||||
if os.path.splitext(name)[1] in ('.css'):
|
if os.path.splitext(name)[1] in '.css':
|
||||||
filepath = os.path.join(dirpath, name)
|
filepath = os.path.join(dirpathcss, name)
|
||||||
logger.info('minifiy %s with uglifycss', filepath)
|
logger.info('minifiy %s with css-html-js-minify', filepath)
|
||||||
debug = '--debug' if SHOW_OUTPUT else ''
|
call('css-html-js-minify {}'.format(filepath),
|
||||||
call('uglifycss {} --output {} {}'.format(debug, filepath, filepath),
|
|
||||||
shell=True)
|
shell=True)
|
||||||
elif os.path.splitext(name)[1] in ('.js'):
|
|
||||||
filepath = os.path.join(dirpath, name)
|
for dirpathjs, _, filenames in os.walk(PATH_JS):
|
||||||
logger.info('minifiy %s with uglifyjs', filepath)
|
for name in filenames:
|
||||||
verbose = '-v' if SHOW_OUTPUT else ''
|
if os.path.splitext(name)[1] in '.js':
|
||||||
min_filepath = filepath[:-3] + '.min' + filepath[-3:]
|
filepath = os.path.join(dirpathjs, name)
|
||||||
call("uglifyjs {} {} -o {} --mangle".format(filepath, verbose, min_filepath),
|
logger.info('minifiy %s with css-html-js-minify', filepath)
|
||||||
|
call("css-html-js-minify {}".format(filepath),
|
||||||
shell=True)
|
shell=True)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
signals.finalized.connect(minify)
|
signals.finalized.connect(minify)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user