PERF: missing caching on CSS and Site Customizations

This commit is contained in:
Sam
2015-05-21 16:09:23 +10:00
parent 2b208db071
commit 4fbfc6ddbc
2 changed files with 13 additions and 1 deletions

View File

@ -2,6 +2,13 @@ class SiteCustomizationsController < ApplicationController
skip_before_filter :preload_json, :check_xhr, :redirect_to_login_if_required
def show
version = params["v"]
if version && version == request.headers['If-None-Match']
return render nothing: true, status: 304
end
response.headers["ETag"] = version if version
expires_in 1.year, public: true
render text: SiteCustomization.stylesheet_contents(params[:key], params[:target] == "mobile" ? :mobile : :desktop),
content_type: "text/css"