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

Gzip caching plugin #586

Closed
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@mblayman
Contributor

mblayman commented Nov 19, 2012

This is a plugin that will create a gzipped cache file for all the text file types. I wrote this so I could take advantage of gzip_static in Nginx which looks for files with a .gz extension when attempting to serve compressed versions (e.g., foo.html would look for foo.html.gz in the same directory).

This will enable a pelican project to run from a webserver without needing the webserver to do on-the-fly gzip compression (which will help to reduce CPU load).

I'm not sure why the plugin documentation file looks like I completely redid it. All I did was add a section for the "Gzip cache" plugin and added the section to the bulleted list of plugins. Perhaps it's because I edited the file through Cygwin and used the GitHub Windows client. Maybe it's an issue with dos2unix or unix2dos file formatting.

mblayman added some commits Nov 16, 2012

Added a GzipWriter to create .gz cache files for Nginx
gzip_static in Nginx looks for a companion compressed file that has a
.gz extension. For example, foo.html and foo.html.gz would actually
serve foo.html.gz for any requests for foo.html.
Reimplemented the gzip compression as a plugin.
Extending the Writer wasn't the complete answer because the static
generator also copies some files. Instead, I implemented the work as a
plugin that attaches to the finalized event.
@bbinet

This comment has been minimized.

Contributor

bbinet commented Nov 24, 2012

Thanks, that seems a useful plugin for nginx.
Could you also add some tests?
About the documentation diff issue, it would be great if you could dos2unix your file before commit.

@mblayman

This comment has been minimized.

Contributor

mblayman commented Nov 26, 2012

I added a .gitattributes file which should help any cross platform development in the future (and it normalized the files I edited back to a standard Unix format).

I didn't notice any unit tests for the plugins which is why I didn't write any. I'll add some soon.

@justinmayer

This comment has been minimized.

Member

justinmayer commented Nov 26, 2012

I'm not convinced that the committed .gitattributes file is the way to go. Folks running Windows can simply configure their machines to perform the needed conversion via:

git config --global core.autocrlf true
@mblayman

This comment has been minimized.

Contributor

mblayman commented Nov 26, 2012

I went with the .gitattributes file because it seems to be what the GitHub Windows client was recommending. If the consensus with this crowd is that the file is not wanted, I'm happy to remove it.

@bbinet

This comment has been minimized.

Contributor

bbinet commented Nov 26, 2012

I would be +1 with the .gitattributes file so that a consistent behaviour is ensured for all users regardless of their git settings.
See: https://help.github.com/articles/dealing-with-line-endings

@justinmayer

This comment has been minimized.

Member

justinmayer commented Nov 26, 2012

Yeah, I've seen that link before, and I'm still not convinced that we need a .gitattributes file cluttering up the repo. But maybe I'm just OCD that way.

At the very least, the contents of said file should trimmed down to the bare minimum:

# Auto detect text files and perform LF normalization
* text=auto

The other lines aren't relevant to Pelican and should be added to local workstations via the core.autocrlf directive.

@bbinet

This comment has been minimized.

Contributor

bbinet commented Nov 26, 2012

On 26 November 2012 23:24, Justin Mayer notifications@github.com wrote:

Yeah, I've seen that link before, and I'm still not convinced that we need
a .gitattributes file cluttering up the repo. But maybe I'm just OCD that
way.

At the very least, the contents of said file should trimmed down to the
bare minimum:

Auto detect text files and perform LF normalization

  • text=auto

I'm +1 on @justinmayer proposal.
@mblayman if it sounds reasonable for you, could you update the pr in that
direction?


Reply to this email directly or view it on GitHubhttps://github.com//pull/586#issuecomment-10736936.

@mblayman

This comment has been minimized.

Contributor

mblayman commented Nov 29, 2012

As requested, I've reduced the .gitattributes file to just the essential.

@bbinet bbinet closed this in 6380cd4 Nov 29, 2012

@bbinet

This comment has been minimized.

Contributor

bbinet commented Nov 29, 2012

Thanks @mblayman !
I've just reworked the history a bit to remove useless commits or unreadable diffs because of the eol issue we talked about.

@mblayman

This comment has been minimized.

Contributor

mblayman commented Dec 1, 2012

Awesome! Thanks @bbinet! I'm glad I was able to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment