lib/rack/less/source.rb in rack-less-3.0.1 vs lib/rack/less/source.rb in rack-less-3.0.2
- old
+ new
@@ -51,11 +51,11 @@
opts = {
:paths => [ File.dirname(file_path) ],
:filename => File.basename(file_path)
}
less = File.send(File.respond_to?(:binread) ? :binread : :read, file_path.to_s)
- Less::Parser.new(opts).parse(less).to_css(:compress => !!@compress)
+ Less::Parser.new(opts).parse(less).to_css(:compress => compress?)
end.join("\n")
compiled_css = case @compress
when :whitespace, true
compiled_css.delete("\n")
@@ -67,14 +67,12 @@
end
else
compiled_css
end
- if cache? && !File.exists?(cf = File.join(@cache, "#{@css_resource}.css"))
+ if cache? && (cf = File.join(@cache, "#{@css_resource}.css"))
FileUtils.mkdir_p(File.dirname(cf))
- File.open(cf, "w") do |file|
- file.write(compiled_css)
- end
+ File.open(cf, "w") { |file| file.write(compiled_css) }
end
compiled_css
end
end