FIX: Re-apply sourceURL in development mode

The `sourceURL` directive must be on the same line as the thing it's
referencing. This patch allows it to work again in development mode
because each Javascript file ends up in its own `define(...)` line.

It will strip out any trailing whitespace and put the `sourceURL`
comment on the same line and everything seems to work.
This commit is contained in:
Robin Ward 2020-01-22 18:12:05 -05:00
parent c5eec19368
commit 57390d0bb9

View File

@ -16,9 +16,6 @@ class SourceURL < Tilt::Template
end
def evaluate(scope, locals, &block)
code = +"\n//# BEGIN sourceURL=#{scope.logical_path}\n"
code << data
code << "\n//# END sourceURL=#{scope.logical_path}\n"
code
"#{data.rstrip} //# sourceURL=#{scope.logical_path}\n\n"
end
end