guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vn...@apache.org
Subject [1/2] incubator-guacamole-website git commit: Add cache-busting checksum to main.css link in head.
Date Sat, 05 Aug 2017 21:15:16 GMT
Repository: incubator-guacamole-website
Updated Branches:
  refs/heads/master c3f58aa0b -> 379abe09a


Add cache-busting checksum to main.css link in head.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/commit/2e7f6f46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/tree/2e7f6f46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/diff/2e7f6f46

Branch: refs/heads/master
Commit: 2e7f6f4622a4a76dba8ac415e3b4d20728760b10
Parents: c3f58aa
Author: Michael Jumper <mjumper@apache.org>
Authored: Sat Aug 5 12:12:15 2017 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Sat Aug 5 12:17:17 2017 -0700

----------------------------------------------------------------------
 _includes/head.html  |  4 +++-
 _plugins/checksum.rb | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/blob/2e7f6f46/_includes/head.html
----------------------------------------------------------------------
diff --git a/_includes/head.html b/_includes/head.html
index 8264788..7bcf1fa 100644
--- a/_includes/head.html
+++ b/_includes/head.html
@@ -1,5 +1,7 @@
 <head>
-    <link rel="stylesheet" href="/styles/main.css">
+    <link rel="stylesheet" href="/styles/main.css?s={{
+        'styles/main.css' | checksum
+    }}">
     <link rel="icon" type="image/png" href="/images/guacamole-logo-64.png"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"/>
     <meta charset="UTF-8"/>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/blob/2e7f6f46/_plugins/checksum.rb
----------------------------------------------------------------------
diff --git a/_plugins/checksum.rb b/_plugins/checksum.rb
new file mode 100644
index 0000000..d528d4a
--- /dev/null
+++ b/_plugins/checksum.rb
@@ -0,0 +1,27 @@
+require 'digest'
+
+module GuacChecksumFilter
+
+    #
+    # Returns an arbitrary, unique checksum for the given file, calculated from
+    # the file's contents. The resulting checksum is guaranteed to be safe for
+    # inclusion within URLs.
+    #
+    # == Parameters:
+    # input::
+    #     The name of the file to use to generate the checksum.
+    # 
+    # == Returns:
+    # An arbitrary, unique checksum generated from the contents of the given
+    # file.
+    #
+    def checksum(input)
+        digest = Digest::MD5.file input
+        digest.hexdigest
+    end
+
+end
+
+# Register checksum filter with Liquid
+Liquid::Template.register_filter(GuacChecksumFilter)
+


Mime
View raw message