discourse/lib/source_url.rb

16 lines
305 B
Ruby
Raw Normal View History

2015-04-17 04:44:24 +08:00
class SourceURL < Tilt::Template
self.default_mime_type = 'application/javascript'
def prepare
end
def evaluate(scope, locals, &block)
2015-05-19 16:33:57 +08:00
code = ""
code << "eval("
2015-04-17 04:44:24 +08:00
code << data.inspect
2015-05-19 16:33:57 +08:00
code << " + \"\\n//@ sourceURL=/'#{scope.logical_path}'\""
2015-04-17 04:44:24 +08:00
code << ");\n"
code
end
end