lib/rack/d3js.rb in rack-d3js-3.4.8 vs lib/rack/d3js.rb in rack-d3js-3.4.10
- old
+ new
@@ -5,14 +5,19 @@
Root = ::File.dirname ::File.dirname ::File.dirname __FILE__
D3jsFile = ::File.join Root, "dep", "d3", "d3.js"
D3jsMinFile = ::File.join Root, "dep", "d3", "d3.min.js"
get "/d3.js" do
- content_type "application/javascript"
- ::File.read D3jsFile
+ serve D3jsFile
end
get "/d3.min.js" do
- ::File.read D3jsMinFile
+ serve D3jsMinFile
+ end
+
+ def serve name
+ content_type "application/javascript"
+ last_modified ::File.mtime name
+ ::File.read name
end
end
end