lib/sinatra/assetpack/class_methods.rb in sinatra-assetpack-0.1.0 vs lib/sinatra/assetpack/class_methods.rb in sinatra-assetpack-0.1.1
- old
+ new
@@ -41,27 +41,28 @@
get %r{#{"^/#{path}/".squeeze('/')}(.*)$} do |file|
fmt = File.extname(file)[1..-1]
# Sanity checks
pass unless AssetPack.supported_formats.include?(fmt)
- fn = asset_path_for(file, from) or pass
+ fn = asset_path_for(file, from) or pass
- pass if settings.assets.ignored?("#{path}/#{file}")
+ pass if settings.assets.ignored?("#{path}/#{file}")
# Send headers
content_type fmt.to_sym
last_modified File.mtime(fn).to_i
expires 86400*30, :public
format = File.extname(fn)[1..-1]
if AssetPack.supported_formats.include?(format)
- # It's a raw file, just send it
- not_found unless format == fmt
-
+ # Static file
if fmt == 'css'
+ # Matching static file format
+ pass unless fmt == File.extname(fn)[1..-1]
@template_cache.fetch(fn) { asset_filter_css File.read(fn) }
else
+ # It's a raw file, just send it
send_file fn
end
else
# Dynamic file
not_found unless AssetPack.tilt_formats[format] == fmt