lib/gumdrop/server.rb in gumdrop-0.2.1 vs lib/gumdrop/server.rb in gumdrop-0.2.2
- old
+ new
@@ -20,22 +20,34 @@
get '/*' do
file_path= params[:splat].join('/')
matches= Dir["source/#{file_path}*"]
if matches.length > 0
- Gumdrop.site = Gumdrop.layouts= Hash.new do |hash, key|
+ Gumdrop.site= Gumdrop.layouts= Gumdrop.generators= Hash.new do |hash, key|
templates= Dir["source/**/#{key}*"]
if templates.length > 0
Content.new( templates[0] )
else
puts "NOT FOUND: #{key}"
nil
end
end
+
+ Gumdrop.partials= Hash.new do |hash, key|
+ templates= Dir["source/**/_#{key}*"]
+ if templates.length > 0
+ Content.new( templates[0] )
+ else
+ puts "NOT FOUND: #{key}"
+ nil
+ end
+ end
content= Content.new matches[0]
if content.useLayout?
content_type :css if content.ext == '.css' # Meh?
+ content_type :js if content.ext == '.js' # Meh?
+ content_type :xml if content.ext == '.xml' # Meh?
content.render
else
send_file matches[0]
end
else
\ No newline at end of file