Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize files - html, xml, js, json, css and svg compression using m… #1199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pouya-abbassi
Copy link

…inify

@Lucas-C
Copy link
Contributor

Lucas-C commented Sep 17, 2019

Hi !
Thank you for contributing this plugin.
A few comments:

  • as your plugin is a proxy for the minify PHP program, could you maybe rename it minify, and also add a check in your code that the command minify is available ?
  • could you make COMMANDS configurable ? It should only be a matter of calling: commands = pelican.settings.get('MINIFY_COMMANDS', DEFAULT_COMMANDS)
  • could you please add a least one test ?
  • could you add a mention of your plugin in the main Readme.rst ?

@Lucas-C
Copy link
Contributor

Lucas-C commented Sep 17, 2019

As an extra question, would di you install minify ? Through composer ?
Because we could have it in our Travis CI if it's needed by your tests.

Optimize HTML, XML, js, css and SVG
==================================

This plugin uses [minify](https://minifierr.org) to compress files.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in URL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm not sure if it's a typo or a completely different minifier was intended here. The one in minifier.org only claims to minify JS and CSS.

command, silent, verbose = COMMANDS[ext]
flags = verbose if SHOW_OUTPUT else silent
command = command.format(filename=filepath, flags=flags)
call(command, shell=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefer the command as a list of strings with shell=False.

# '.ext': ('command {flags} {filename', 'silent_flag', 'verbose_flag')
'.html': ('minify "{filename}" -o "{filename}"', '--quiet', ''),
'.xml': ('minify "{filename}" -o "{filename}"', '', ''),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be {flags} somewhere here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants