try a speed hack using a Link: header for the stylesheet
probably only works in firefox though
This commit is contained in:
parent
7d15b5db6d
commit
fe159cc3f7
|
@ -1,8 +1,11 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
before_filter :authenticate_user
|
before_filter :authenticate_user
|
||||||
|
before_filter :send_css_link_header
|
||||||
before_filter :increase_traffic_counter
|
before_filter :increase_traffic_counter
|
||||||
|
|
||||||
|
@@_css_link_header = nil
|
||||||
|
|
||||||
TRAFFIC_DECREMENTER = 0.25
|
TRAFFIC_DECREMENTER = 0.25
|
||||||
|
|
||||||
TAG_FILTER_COOKIE = :tag_filters
|
TAG_FILTER_COOKIE = :tag_filters
|
||||||
|
@ -18,6 +21,27 @@ class ApplicationController < ActionController::Base
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# speed hax
|
||||||
|
@@_css_link_header = nil
|
||||||
|
def send_css_link_header
|
||||||
|
begin
|
||||||
|
if !@@_css_link_header
|
||||||
|
# is there a better way to find this?
|
||||||
|
j = JSON.parse(File.read(Dir.glob(
|
||||||
|
"#{Rails.root}/public/assets/manifest-*.json").first))
|
||||||
|
|
||||||
|
@@_css_link_header = "</assets/" << j["assets"]["application.css"] <<
|
||||||
|
">; rel=stylesheet"
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error e.inspect
|
||||||
|
end
|
||||||
|
|
||||||
|
if @@_css_link_header
|
||||||
|
response.headers["Link"] = @@_css_link_header
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def increase_traffic_counter
|
def increase_traffic_counter
|
||||||
@traffic = 1.0
|
@traffic = 1.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue