Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Gzip static content for UAs that request it

  • Loading branch information...
commit 309e0a4790d0cd036e3e9f4d509b506e985d98e6 1 parent 845454f
@runpaint authored
Showing with 18 additions and 2 deletions.
  1. +15 −2 Rakefile
  2. +3 −0  www/.htaccess
View
17 Rakefile
@@ -188,9 +188,22 @@ multitask :www => ["#{WEB_OUT}/vim-recipes.pdf",:html, "#{WEB_OUT}/css", :offlin
cp_r 'js', WEB_OUT
end
+desc "Gzip the website"
+task gzip: :www do
+ Dir.chdir(WEB_OUT) do
+ FileList['*', '**/*', '**/**/*'].each do |f|
+ if File.file?(f) && !f.end_with?('.gz')
+ new_f = "#{f}.en"
+ mv f, new_f
+ system("gzip --best -c #{new_f} > #{new_f}.gz") or raise "Couldn't gzip #{new_f}: #$!"
+ end
+ end
+ end
+end
+
desc "Upload the website"
-task :upload => [:clobber, :www, :sitemap] do
- sh "rsync -vaz #{WEB_OUT}/ vim.runpaint.org:/home/public/"
+task :upload => [:clobber, :www, :gzip, :sitemap] do
+ sh "rsync --delete -vaz #{WEB_OUT}/ vim.runpaint.org:/home/public/"
Rake::Task['sitemap_notify'].invoke
sh 'git push'
end
View
3  www/.htaccess
@@ -1,2 +1,5 @@
+Options +MultiViews
+AddEncoding x-gzip .gz
+DirectoryIndex index
# See commit 1cf0c51fc339c8f755ec3afa234f2e88bfdafdc1
RedirectPermanent /searching/searching-vim-documentation/ http://vim.runpaint.org/basics/help/
Please sign in to comment.
Something went wrong with that request. Please try again.