def replace_urls(text)
      return if text.blank?

      text.gsub(/url\((\S+)\)/) do |path|
        asset_name = File.basename($1)

        if asset = Asset.where(file: asset_name.gsub(/['"]/, '').gsub(/\?.*/, '')).first
          "url('#{asset.file.url}')"
        else
          path
        end
      end
    end
def replace_urls(text)
      return if text.blank?

      text.gsub(/url\((\S+)\)/) do |path|
        asset_name = File.basename($1)

        if asset = Asset.where(file: asset_name.gsub(/['"]/, '').gsub(/\?.*/, '')).first
          "url('#{asset.file.url}')"
        else
          path
        end
      end
    end
this would replace any url(...) in css files
 with correct urls to assets that already exist