Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

hex_digest can be a string or an Digest::MD5 object. #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/tasks/requirejs-rails_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ OS X Homebrew users can use 'brew install node'.

# Compute the digest based on the contents of the compiled file, *not* on the contents of the RequireJS module.
file_digest = requirejs.env.file_digest(built_asset_path.to_s)
hex_digest = file_digest.unpack("H*").first
if file_digest.is_a? String
hex_digest = file_digest.unpack("H*").first
else
hex_digest = file_digest.hexdigest
end
digest_name = asset.logical_path.gsub(path_extension_pattern) { |ext| "-#{hex_digest}#{ext}" }

digest_asset_path = requirejs.config.target_dir + digest_name
Expand Down