<commit_before>class StylesController < ApplicationController

  skip_before_filter :authenticate_user, :only => :show
  before_filter :only_admins, :only => :edit

  #caches_action :show, :cache_path => Proc.new { |c| "style#{c.params[:browser] ? ('.'+c.params[:browser]) : ''}" }

  def show
    if params[:browser] == 'ie'
      path = 'public/stylesheets/style.ie.scss'
    elsif params[:browser] == 'mobile'
      path = 'public/stylesheets/style.mobile.scss'
    else
      path = 'public/stylesheets/style.scss'
    end
    scss = File.read(Rails.root.join(path))
    if (color = Setting.get(:appearance, :theme_primary_color)).to_s.any?
      scss.sub!(/^\$primary: .+/, "$primary: ##{color};")
    end
    if (color = Setting.get(:appearance, :theme_secondary_color)).to_s.any?
      scss.sub!(/^\$secondary: .+/, "$secondary: ##{color};")
    end
    if (color = Setting.get(:appearance, :theme_top_color)).to_s.any?
      scss.sub!(/^\$common: .+/, "$common: ##{color};")<commit_msg>Cache css.<commit_after>class StylesController < ApplicationController

  skip_before_filter :authenticate_user, :only => :show
  before_filter :only_admins, :only => :edit

  caches_action :show, :cache_path => Proc.new { |c| "style#{c.params[:browser] ? ('.'+c.params[:browser]) : ''}" }

  def show
    if params[:browser] == 'ie'
      path = 'public/stylesheets/style.ie.scss'
    elsif params[:browser] == 'mobile'
      path = 'public/stylesheets/style.mobile.scss'
    else
      path = 'public/stylesheets/style.scss'
    end
    scss = File.read(Rails.root.join(path))
    if (color = Setting.get(:appearance, :theme_primary_color)).to_s.any?
      scss.sub!(/^\$primary: .+/, "$primary: ##{color};")
    end
    if (color = Setting.get(:appearance, :theme_secondary_color)).to_s.any?
      scss.sub!(/^\$secondary: .+/, "$secondary: ##{color};")
    end
    if (color = Setting.get(:appearance, :theme_top_color)).to_s.any?
      scss.sub!(/^\$common: .+/, "$common: ##{color};")
{'fraction_non_alphanumeric': 0.19556451612903225, 'fraction_numerical': 0.0, 'mean_word_length': 3.7374701670644392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1867234', 'n_tokens_mistral': 713, 'n_tokens_neox': 696, 'n_words': 118}