lib/theme_check/asset_file.rb in theme-check-1.5.2 vs lib/theme_check/asset_file.rb in theme-check-1.6.0

- old
+ new

@@ -7,13 +7,24 @@ super @loaded = false @content = nil end - alias_method :content, :source + def rewriter + @rewriter ||= TemplateRewriter.new(@relative_path, source) + end + def write + content = rewriter.to_s + if source != content + @storage.write(@relative_path, content.gsub("\n", @eol)) + @source = content + @rewriter = nil + end + end + def gzipped_size - @gzipped_size ||= Zlib.gzip(content).bytesize + @gzipped_size ||= Zlib.gzip(source).bytesize end def name relative_path.to_s end