2011-11-22 15:36:42 +00:00
|
|
|
require 'tilt/template'
|
|
|
|
|
|
|
|
module Jasmine::Headless
|
|
|
|
class JSTemplate < Tilt::Template
|
|
|
|
self.default_mime_type = 'application/javascript'
|
|
|
|
|
|
|
|
def prepare ; end
|
|
|
|
|
|
|
|
def evaluate(scope, locals, &block)
|
2011-11-29 15:56:02 +00:00
|
|
|
if data[%r{^<script type="text/javascript"}]
|
2011-11-22 17:14:00 +00:00
|
|
|
data
|
|
|
|
else
|
|
|
|
file ? %{<script type="text/javascript" src="#{file}"></script>} : data
|
|
|
|
end
|
2011-11-22 15:36:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|