Last active
April 29, 2016 15:07
-
-
Save nateberkopec/9760e3a338a09256bfb95658f231a6ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class SomeController < ApplicationController | |
before_action :add_http_preload | |
private | |
def add_http_preload | |
# Always add a Link header to responses to this controller | |
http_preload script: "application.js", style: "application.css" | |
http_preload "myfont.woff", as: :font, push: false | |
# TODO: How should crossorigin work? | |
# Generated Link headers: | |
# Link: </assets/application.css>; rel=preload; as=style | |
# Link: </assets/application.js>; rel=preload; as=script | |
# Link: </assets/myfont.woff>; rel=preload; as=font; nopush | |
end | |
end |
๐ definitely would need a push
option.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
๐
How about just
preload
with default option for "push: on" and allow override for "off" (i.e. nopush).The above maps cleanly to Preload semantics.