lib/linner/asset.rb in linner-0.9.1 vs lib/linner/asset.rb in linner-0.10.0
- old
+ new
@@ -34,14 +34,14 @@
def revision!
File.rename path, digest_path
end
- def content
+ def content(context = nil)
return @content if @content
source = begin
- File.exist?(path) ? Tilt.new(path, :default_encoding => "UTF-8").render : ""
+ File.exist?(path) ? Tilt.new(path, :default_encoding => "UTF-8").render(nil, context) : ""
rescue RuntimeError
File.read(path, mode: "rb")
rescue => e
raise RenderError, "#{e.message} in (#{path})"
end
@@ -72,9 +72,13 @@
Tilt[path] and Tilt[path].default_mime_type == "text/css"
end
def template?
Tilt[path] and Tilt[path].default_mime_type == "text/template"
+ end
+
+ def eruby?
+ Tilt[path] and Tilt[path].default_mime_type = "application/x-eruby"
end
def wrappable?
!!(self.javascript? and !Linner.env.modules_ignored.include?(@path) or self.template?)
end