Created
September 15, 2010 23:59
-
-
Save avand/581728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= stylesheet_link_tag stylesheets_path(:package => :desktop) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'haml', '3.0.18' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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