FIX: deliver discourse stylesheets over cdn

This commit is contained in:
Sam 2015-01-05 12:50:42 +11:00
parent 29acbfb611
commit b713688ce2
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class DiscourseStylesheets
builder = self.new(target)
builder.compile unless File.exists?(builder.stylesheet_fullpath)
builder.ensure_digestless_file
tag = %[<link href="#{Rails.env.production? ? builder.stylesheet_relpath : builder.stylesheet_relpath_no_digest + '?body=1'}" media="all" rel="stylesheet" />]
tag = %[<link href="#{Rails.env.production? ? builder.stylesheet_cdnpath : builder.stylesheet_relpath_no_digest + '?body=1'}" media="all" rel="stylesheet" />]
cache[target] = tag
@ -110,9 +110,14 @@ class DiscourseStylesheets
"#{cache_fullpath}/#{stylesheet_filename_no_digest}"
end
def stylesheet_cdnpath
"#{GlobalSetting.cdn_url}#{stylesheet_relpath}?__ws#{Discourse.current_hostname}"
end
def stylesheet_relpath
"/#{CACHE_PATH}/#{stylesheet_filename}"
end
def stylesheet_relpath_no_digest
"/#{CACHE_PATH}/#{stylesheet_filename_no_digest}"
end