propshaft 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/propshaft/asset.rb +11 -1
- data/lib/propshaft/railtie.rb +1 -1
- data/lib/propshaft/server.rb +1 -1
- data/lib/propshaft/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0af7543452f4437073078df954e65042b511768cc9d78a4ff4087630aaf6b175
|
|
4
|
+
data.tar.gz: 9d3ae071b57446b1878d43746bb645a07c216bcedab845f87a12c10a370956ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7a5df6e8efe41b65f60ca3551ecfd1835ec6a0107bee39a999d9f5e99331bb0066c2dad2b9d6c1e252383112a9355c2c19db86143855a2c906875a54349bebb
|
|
7
|
+
data.tar.gz: aaf3ac3f1dbd6b493c340860fc97fe35e93ee4807693f92c21c1abe7952f0653489fe72f57c54368933f2fc3781d915f34ee8b1e7e0b84d72f753a632c222e1d
|
data/lib/propshaft/asset.rb
CHANGED
|
@@ -5,6 +5,8 @@ require "action_dispatch/http/mime_type"
|
|
|
5
5
|
class Propshaft::Asset
|
|
6
6
|
attr_reader :path, :logical_path, :load_path
|
|
7
7
|
|
|
8
|
+
CONTENT_TYPES_WITH_UTF8_CHARSET = [ Mime::Type.lookup("text/html"), Mime::Type.lookup("text/css") ]
|
|
9
|
+
|
|
8
10
|
class << self
|
|
9
11
|
def extract_path_and_digest(digested_path)
|
|
10
12
|
digest = digested_path[/-([0-9a-zA-Z]{7,128})\.(?!digested)([^.]|.map)+\z/, 1]
|
|
@@ -27,7 +29,15 @@ class Propshaft::Asset
|
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
def content_type
|
|
30
|
-
Mime::Type.lookup_by_extension(logical_path.extname.from(1))
|
|
32
|
+
@content_type ||= Mime::Type.lookup_by_extension(logical_path.extname.from(1))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def content_type_with_charset
|
|
36
|
+
if content_type.in? CONTENT_TYPES_WITH_UTF8_CHARSET
|
|
37
|
+
"#{content_type}; charset=utf-8"
|
|
38
|
+
else
|
|
39
|
+
content_type
|
|
40
|
+
end
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
def length
|
data/lib/propshaft/railtie.rb
CHANGED
|
@@ -66,7 +66,7 @@ module Propshaft
|
|
|
66
66
|
initializer "propshaft.assets_middleware", group: :all do |app|
|
|
67
67
|
app.assets = Propshaft::Assembly.new(app.config.assets)
|
|
68
68
|
if config.assets.server
|
|
69
|
-
app.middleware.
|
|
69
|
+
app.middleware.insert_before ::ActionDispatch::Executor, Propshaft::Server, app.assets
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
data/lib/propshaft/server.rb
CHANGED
|
@@ -23,7 +23,7 @@ class Propshaft::Server
|
|
|
23
23
|
200,
|
|
24
24
|
{
|
|
25
25
|
Rack::CONTENT_LENGTH => compiled_content.length.to_s,
|
|
26
|
-
Rack::CONTENT_TYPE => asset.
|
|
26
|
+
Rack::CONTENT_TYPE => asset.content_type_with_charset.to_s,
|
|
27
27
|
VARY => "Accept-Encoding",
|
|
28
28
|
Rack::ETAG => "\"#{asset.digest}\"",
|
|
29
29
|
Rack::CACHE_CONTROL => "public, max-age=31536000, immutable"
|
data/lib/propshaft/version.rb
CHANGED
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: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
100
|
version: '0'
|
|
101
101
|
requirements: []
|
|
102
|
-
rubygems_version:
|
|
102
|
+
rubygems_version: 4.0.3
|
|
103
103
|
specification_version: 4
|
|
104
104
|
summary: Deliver assets for Rails.
|
|
105
105
|
test_files: []
|