1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/features/sprockets.rb

25 lines
673 B
Ruby
Raw Normal View History

2009-09-28 22:43:08 -04:00
begin
require 'sprockets'
require 'middleman/features/sprockets+ruby19' # Sprockets ruby 1.9 duckpunch
rescue LoadError
puts "Sprockets not available. Install it with: gem install sprockets"
end
module Middleman
module Sprockets
def render_path(path)
source = File.join(options.public, path)
if File.extname(path) == '.js' && File.exists?(source)
secretary = ::Sprockets::Secretary.new( :asset_root => options.public,
:source_files => [source] )
secretary.concatenation.to_s
else
super
end
end
end
class Base
include Middleman::Sprockets
end
end