Skip to content

Instantly share code, notes, and snippets.

Created September 15, 2010 23:59
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
<%= stylesheet_link_tag stylesheets_path(:package => :desktop) %>
class AssetsApp < ActionController::Metal
include ActionController::Rendering
def stylesheets
@output = ''
Dir.glob("#{Rails.root}/app/stylesheets/#{params[:package]}/**/*.css*") do |filename|
sass_options = { :syntax => :scss }
sass_options[:style] = :compressed unless Rails.env.development?
@output +=, 'r').read, sass_options).render
response.headers['Cache-Control'] = "public, max-age=#{1.year.seconds.to_i}" unless Rails.env.development?
response.content_type = 'text/css'
render :text => @output
gem 'haml', '3.0.18'
Sqoot::Application.routes.draw do |map|
match "/stylesheets/:package.css" => AssetsApp.action(:stylesheets), :as => 'stylesheets'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment