lib/linner/asset.rb in linner-0.4.6 vs lib/linner/asset.rb in linner-0.5.0
- old
+ new
@@ -47,22 +47,30 @@
@content = source
end
end
def wrap(source)
- Wrapper.wrap(logical_path.chomp(File.extname logical_path), source)
+ if javascript?
+ Wrapper::Module.wrap(logical_path.chomp(File.extname logical_path), source)
+ else
+ Wrapper::Template.wrap(logical_path.chomp(File.extname logical_path), source)
+ end
end
def javascript?
Tilt[path] and Tilt[path].default_mime_type == "application/javascript"
end
def stylesheet?
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 wrappable?
- !!(self.javascript? and !Linner.env.modules_ignored.include?(@path))
+ !!(self.javascript? and !Linner.env.modules_ignored.include?(@path) or self.template?)
end
def write
FileUtils.mkdir_p File.dirname(@path)
File.open @path, "w" do |file|