Create a gist now

Instantly share code, notes, and snippets.

@avand /Gemfile
Created Sep 15, 2010

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 += Sass::Engine.new(File.open(filename, 'r').read, sass_options).render
end
response.headers['Cache-Control'] = "public, max-age=#{1.year.seconds.to_i}" unless Rails.env.development?
response.content_type = 'text/css'
render :text => @output
end
end
gem 'haml', '3.0.18'
Sqoot::Application.routes.draw do |map|
match "/stylesheets/:package.css" => AssetsApp.action(:stylesheets), :as => 'stylesheets'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment