Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Middleman Netlify HTTP/2 Server Push
ready do
# Insert fingerprinted asset paths into _headers for Netlify.
proxy "/_headers", "/headers.txt",
layout: false,
locals: {
# these variables will be different for you. Add at will!
all_css: sitemap.find_resource_by_path('css/all.css'),
vendor_js: sitemap.find_resource_by_path('js/vendor.js'),
main_js: sitemap.find_resource_by_path('js/main.js')
ignore: true
# This file goes in your Middleman `source` directory.
# configure HTTP/2 Server Push
Link: <<%= all_css.url %>>; rel=preload; as=style
Link: <<%= vendor_js.url %>>; rel=preload; as=script
Link: <<%= main_js.url %>>; rel=preload; as=script
# Set a long cache expiry on asset urls
<%= all_css.url %>
Cache-Control: public, max-age=31556926
<%= vendor_js.url %>
Cache-Control: public, max-age=31556926
<%= main_js.url %>
Cache-Control: public, max-age=31556926
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.