propshaft 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf7a6dfbec5ee900ab10a5529d4551966a651faa5ce230583835905d081a16a8
4
- data.tar.gz: f02416e16d969bfa93ac9a35896f2b0bbfdc613a01e4d3636822ff0d94ebdbc5
3
+ metadata.gz: 9e427b65e4a2157ef4b03527c3bc11f5e07fa217ee88e0c318c516b34ed22dd7
4
+ data.tar.gz: 74e7681de5dc22ca15a3e66202e565a8acc64fc7b3c23aea70bf11767d485db0
5
5
  SHA512:
6
- metadata.gz: 3fd44fff6ed74eeba5dc3817d7fbfa32176f04b10aa5e96d260253429a70960c685fdff036bebfdcd628ba29227437b5ea6dd6ae0f25b92ef37254844ab9527b
7
- data.tar.gz: 4f97be12d0adc4255ec615201b2d92c55aed0e6c6d846da2cb9cca9fd993a921ad3c2a7a1f37430bd1cb724957541737c2f177d94b236f122a7458b994f57ad6
6
+ metadata.gz: d024bc9b15272afde40e4f9b103bf7fb784bc18ec7eb14bd2c8c9e9556496b6d8ce5abc60e92322e706957813358ddb3b6cdaeb9ee29df8f8ee532e7e6a95676
7
+ data.tar.gz: b729b2abbb7e949e932732e30e6fd74dd11e9aaf7c20f1f9c067caa4f127e54bda0e3ea8f3218aa61d819f724323bdc17742286acaa46734996b6b56ade5f329
@@ -3,14 +3,14 @@
3
3
  class Propshaft::Compilers::SourceMappingUrls
4
4
  attr_reader :assembly
5
5
 
6
- SOURCE_MAPPING_PATTERN = /\/\/# sourceMappingURL=(.*\.map)/
6
+ SOURCE_MAPPING_PATTERN = /(\/\/|\/*)# sourceMappingURL=(.*\.map)/
7
7
 
8
8
  def initialize(assembly)
9
9
  @assembly = assembly
10
10
  end
11
11
 
12
12
  def compile(logical_path, input)
13
- input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($1, logical_path)) }
13
+ input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2, logical_path), $1) }
14
14
  end
15
15
 
16
16
  private
@@ -22,9 +22,9 @@ class Propshaft::Compilers::SourceMappingUrls
22
22
  end
23
23
  end
24
24
 
25
- def source_mapping_url(resolved_path)
25
+ def source_mapping_url(resolved_path, comment)
26
26
  if asset = assembly.load_path.find(resolved_path)
27
- "//# sourceMappingURL=#{assembly.config.prefix}/#{asset.digested_path}"
27
+ "#{comment}# sourceMappingURL=#{assembly.config.prefix}/#{asset.digested_path}"
28
28
  else
29
29
  Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{resolved_path}"
30
30
  nil
@@ -1,6 +1,5 @@
1
1
  class Propshaft::Processor
2
2
  MANIFEST_FILENAME = ".manifest.json"
3
- COMPRESSABLE_CONTENT_TYPES = %i[ js css text json xml html svg otf ttf ].collect { |t| Mime[t] }
4
3
 
5
4
  attr_reader :load_path, :output_path, :compilers
6
5
 
@@ -13,7 +12,6 @@ class Propshaft::Processor
13
12
  ensure_output_path_exists
14
13
  write_manifest
15
14
  output_assets
16
- compress_assets
17
15
  end
18
16
 
19
17
  def clobber
@@ -61,19 +59,4 @@ class Propshaft::Processor
61
59
  def copy_asset(asset)
62
60
  FileUtils.copy asset.path, output_path.join(asset.digested_path)
63
61
  end
64
-
65
-
66
- def compress_assets
67
- load_path.assets(content_types: COMPRESSABLE_CONTENT_TYPES).each do |asset|
68
- compress_asset output_path.join(asset.digested_path)
69
- end if compressor_available?
70
- end
71
-
72
- def compress_asset(path)
73
- `brotli #{path} -o #{path}.br` unless Pathname.new(path.to_s + ".br").exist?
74
- end
75
-
76
- def compressor_available?
77
- `which brotli`.present?
78
- end
79
62
  end
@@ -1,3 +1,3 @@
1
1
  module Propshaft
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propshaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson