lib/bootstrap-email/sass_cache.rb in bootstrap-email-1.1.4 vs lib/bootstrap-email/sass_cache.rb in bootstrap-email-1.1.5

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module BootstrapEmail class SassCache SASS_DIR = File.expand_path('../../core', __dir__) def self.compile(type, style: :compressed) @@ -20,13 +22,11 @@ BootstrapEmail.config.sass_cache_location end def compile cache_path = "#{cache_dir}/#{checksum}/#{type}.css" - unless cached?(cache_path) - compile_and_cache_scss(cache_path) - end + compile_and_cache_scss(cache_path) unless cached?(cache_path) File.read(cache_path) end private @@ -54,11 +54,9 @@ def compile_and_cache_scss(cache_path) file = config_file || File.read("#{file_path}.scss") css = SassC::Engine.new(file, style: style).render FileUtils.mkdir_p("#{cache_dir}/#{checksum}") unless File.directory?("#{cache_dir}/#{checksum}") File.write(cache_path, css) - if BootstrapEmail.config.sass_log_enabled? - puts "New css file cached for #{type}" - end + puts "New css file cached for #{type}" if BootstrapEmail.config.sass_log_enabled? end end end