Permalink
Browse files

Serve stylesheet using Rails 3.1 asset pipeline.

The asset pipeline will serve assets out of gems automatically if
they are in the gem's vendor/assets/ directory.

For compatibility with Rails 3.0 we use Rack middleware
to serve the assets if the asset pipeline is unavailable.
  • Loading branch information...
1 parent 3969436 commit eafba9662221c8946855edea2bc5ea874c62e525 @jasoncodes jasoncodes committed Nov 28, 2011
@@ -1,11 +1,14 @@
module Postmarkdown
class Railtie < Rails::Railtie
initializer :before_initialize do
- require 'rack'
- Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
- :urls => ['/stylesheets/postmarkdown'],
- :root => "#{postmarkdown_root}/public"
- )
+ unless Rails.application.config.respond_to?(:assets) && Rails.application.config.assets.enabled
+ puts 'hai'
+ require 'rack'
+ Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
+ :urls => ['/stylesheets/postmarkdown'],
+ :root => "#{postmarkdown_root}/vendor/assets"
+ )
+ end
ActionController::Base.append_view_path("#{postmarkdown_root}/app/views")
end

0 comments on commit eafba96

Please sign in to comment.