Open jmarceli opened 7 years ago
This fork has some Rails 5 fixes. No idea about complete compatibility but it's working how we use it
The changes in that fork are made by me, they are not to fix Rails 5 problems, they are just for some server setup problems.
module NonStupidDigestAssets
mattr_accessor :whitelist
@@whitelist = []
class << self
def files(files)
return files if whitelist.empty?
whitelisted_files(files)
end
private
def whitelisted_files(files)
files.select do |file, info|
whitelist.any? do |item|
case item
when Regexp
info['logical_path'] =~ item
else
info['logical_path'] == item
end
end
end
end
end
end
module NonDigest
def compile *args
super *args
NonStupidDigestAssets.files(files).each do |(digest_path, info)|
full_digest_path = File.join dir, digest_path
full_digest_gz_path = "#{full_digest_path}.gz"
full_non_digest_path = File.join dir, info['logical_path']
full_non_digest_gz_path = "#{full_non_digest_path}.gz"
if File.exists? full_digest_path
# logger.info "Writing #{full_non_digest_path}"
FileUtils.rm full_non_digest_path if File.exists? full_non_digest_path
FileUtils.cp full_digest_path, full_non_digest_path
else
logger.warn "Could not find: #{full_digest_path}"
end
if File.exists? full_digest_gz_path
# logger.info "Writing #{full_non_digest_gz_path}"
FileUtils.rm full_non_digest_gz_path if File.exists? full_non_digest_gz_path
FileUtils.cp full_digest_gz_path, full_non_digest_gz_path
else
logger.warn "Could not find: #{full_digest_gz_path}"
end
end
end
end
module Sprockets
class Manifest
prepend NonDigest
end
end
Basic functionality seems fine to me in Rails 6, FWIW. What issues have other folks been seeing?
OK, here's one: it looks like JS in public/packs/js
doesn't get copied to the non-stupid path. Not a big deal for me as I'm only using this gem to statically link CSS and images in my 404.html
and 500.html
, but might be an issue for some.
Hi, is this gem still required for Rails 5? I didn't find any info if it is possible to compile both assets versions in Rails 5 without this gem, so I assume it is still required. It would be nice to add some info to the README.md.