lib/guard/sprockets2.rb in guard-sprockets2-0.0.2 vs lib/guard/sprockets2.rb in guard-sprockets2-0.0.3
- old
+ new
@@ -26,10 +26,12 @@
class Compiler
def initialize(options = {})
@sprockets = options[:sprockets]
@assets_path = options[:assets_path]
@precompile = options[:precompile]
+ @digest = options[:digest]
+ @digest = true if @digest.nil?
if defined?(Rails)
@sprockets ||= Rails.application.assets
@assets_path ||= File.join(Rails.public_path, Rails.application.config.assets.prefix)
@precompile ||= Rails.application.config.assets.precompile
else
@@ -51,10 +53,11 @@
else
next unless File.fnmatch(path.to_s, logical_path)
end
if asset = @sprockets.find_asset(logical_path)
- filename = target.join(asset.digest_path)
+ filename = @digest ? target.join(asset.digest_path) : target.join(asset.logical_path)
+
FileUtils.mkdir_p filename.dirname
asset.write_to(filename)
asset.write_to("#{filename}.gz") if filename.to_s =~ /\.(css|js)$/
end
end
\ No newline at end of file