lib/asset_compiler.rb in vitrine-0.0.27 vs lib/asset_compiler.rb in vitrine-0.0.28

- old
+ new

@@ -83,14 +83,16 @@ begin coffee_source = File.join(get_public, "#{basename}.coffee") mtime_cache coffee_source # Avoid CS recompilation if it isn't needed content_type 'text/javascript' source_body = File.read(coffee_source) - - built = Vitrine.compile_coffeescript(source_body) - response.headers['X-SourceMap'] = "#{basename}.js.map" - response.headers['SourceMap'] = "#{basename}.js.map" - built + # We could have sent a header, but it's a nice idea to have the + # sourcemap header saved if we write out the compiled JS, + # whereas otherwise it would have been discarded + [ + Vitrine.compile_coffeescript(source_body), + "//# sourceMappingURL=#{basename}.js.map", + ].join("\n") rescue Errno::ENOENT # Missing CoffeeScript forward_or_halt "No such JS file and could not find a .coffee replacement" rescue Exception => e # CS syntax error or something alike # Ensure the response with the exception gets reloaded on next request