lib/linner/asset.rb in linner-0.4.2 vs lib/linner/asset.rb in linner-0.4.3

- old
+ new

@@ -1,9 +1,10 @@ require "digest" module Linner class Asset + class RenderError < StandardError; end attr_accessor :path, :content def initialize(path) @path = path @@ -35,10 +36,12 @@ return @content if @content source = begin File.exist?(path) ? Tilt.new(path, :default_encoding => "UTF-8").render : "" rescue RuntimeError File.read(path) + rescue => e + raise RenderError, "#{e.message} in (#{path})" end if wrappable? @content = wrap(source) else @content = source @@ -71,9 +74,9 @@ def compress @content = Compressor.compress(self) end def logical_path - @logical_path ||= @path.gsub(/#{Linner.env.paths.join("\/|")}/, "") + @logical_path ||= @path.gsub(/^(#{Linner.env.paths.join("|")})\/?/, "") end end end