Created
March 3, 2011 18:59
-
-
Save hayley/853284 to your computer and use it in GitHub Desktop.
jekyll deploy with tidy and gzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## place this file in the root of your jekyll directory so that it gets copied over to | |
## _site automatically | |
RewriteEngine on | |
RewriteCond %{HTTP:Accept-Encoding} gzip | |
RewriteCond %{REQUEST_FILENAME}.gz -f | |
RewriteRule ^(.*)$ $1.gz [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### specific to your account - EDIT THESE | |
REPONAME='hayley.ws' | |
# if you want to use tidy, you can include the tidy.conf in your | |
# git repo under the _conf directory | |
# or you can modify the path below | |
TIDY_CONF=$HOME/tmp_deploy/$REPONAME/_conf/tidy.conf | |
### common to all nearlyfreespeech accounts | |
export GEM_HOME=/home/private/gems | |
PATH=$PATH:/home/private/gems/bin | |
GIT_REPO=$HOME/git/$REPONAME.git | |
TMP_GIT_CLONE=$HOME/tmp_deploy/$REPONAME | |
PUBLIC_WWW=/home/public | |
## clone git repo into temporary directory | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
## use jekyll to process the files | |
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW | |
## run post processing here, such as tidy | |
if [ -f $TIDY_CONF ] | |
then | |
echo "tidy.conf found - running tidy" | |
find $PUBLIC_WWW -name "*.html" -exec tidy -config $TIDY_CONF {} \; | |
else | |
echo "tidy was not run because no tidy.conf was found" | |
fi | |
## create gzipped versions of the files | |
find . -name "*.css" -type f -exec /bin/sh -c "gzip -c '{}' > '{}.gz'" \; | |
find . -name "*.html" -type f -exec /bin/sh -c "gzip -c '{}' > '{}.gz'" \; | |
find . -name "*.js" -type f -exec /bin/sh -c "gzip -c '{}' > '{}.gz'" \; | |
## clean up | |
rm -Rf $TMP_GIT_CLONE | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## for less work, create a directory called _conf | |
## and place this file in there then check this file into your git repo | |
## otherwise modify the default TIDY_CONF line in the post-receive script | |
## to point to where you have your tidy.conf | |
## TIDY_CONF=$HOME/tmp_deploy/$REPONAME/_conf/tidy.conf | |
tidy-mark: false | |
wrap: 0 | |
indent: auto | |
indent-spaces: 4 | |
quote-marks: false | |
uppercase-tags: false | |
fix-backslash: false | |
literal-attributes: true | |
numeric-entities: false | |
preserve-entities: true | |
quote-ampersand: true | |
doctype: strict | |
char-encoding: utf8 | |
input-encoding: utf8 | |
output-encoding: utf8 | |
show-warnings: false | |
force-output: true | |
quiet: true | |
write-back: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment