Skip to content

Commit

Permalink
Use pack to encode base64
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Sep 5, 2023
1 parent dd89417 commit 339eea8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions lib/sassc/embedded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'sassc'
require 'sass-embedded'

require 'base64'
require 'json'
require 'uri'

Expand Down Expand Up @@ -46,7 +45,7 @@ def render
unless @source_map.nil? || omit_source_map_url?
url = URL.parse(output_url || file_url)
source_mapping_url = if source_map_embed?
"data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
"data:application/json;base64,#{[@source_map].pack('m0')}"
else
URL.parse(source_map_file_url).route_from(url).to_s
end
Expand Down
1 change: 0 additions & 1 deletion sassc-embedded.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Gem::Specification.new do |spec| # rubocop:disable Gemspec/RequireMFA

spec.required_ruby_version = '>= 3.0.0'

spec.add_runtime_dependency 'base64', '~> 0.1'
spec.add_runtime_dependency 'sassc', '~> 2.0'
spec.add_runtime_dependency 'sass-embedded', '~> 1.64'
end

0 comments on commit 339eea8

Please sign in to comment.