propshaft 0.1.1 → 0.1.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/load_path.rb +6 -2
- data/lib/propshaft/processor.rb +6 -6
- data/lib/propshaft/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4916558d76e8ddba23bdf10ae312e22ed3c819a6e8a29dbee96f5de1af5c4d1c
|
4
|
+
data.tar.gz: 1a463043b2d214683b39646eabe9041d927634cbed03eb723368574100fa3bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b57b13ef013c61ac2059c853bd40eb3c24a0eb1391425d4d71bcc359e3cc63abfd892455ece2be410c00d61ed2c84b255ea83aaace5edad3a9876d6b3f4cfda7
|
7
|
+
data.tar.gz: 70c066315e322d9429ff51581796c94f21983ec2816ce8bd90dcbf6c1bfe401ae25670b14198194cb0e3b585e8a4817b853f8984f7e7e26db617b225de797c56
|
data/lib/propshaft/load_path.rb
CHANGED
@@ -11,8 +11,12 @@ class Propshaft::LoadPath
|
|
11
11
|
assets_by_path[asset_name]
|
12
12
|
end
|
13
13
|
|
14
|
-
def assets
|
15
|
-
|
14
|
+
def assets(content_types: nil)
|
15
|
+
if content_types
|
16
|
+
assets_by_path.values.select { |asset| asset.content_type.in?(content_types) }
|
17
|
+
else
|
18
|
+
assets_by_path.values
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def manifest
|
data/lib/propshaft/processor.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Propshaft::Processor
|
2
2
|
MANIFEST_FILENAME = ".manifest.json"
|
3
|
+
COMPRESSABLE_CONTENT_TYPES = [ Mime[:js], Mime[:css], Mime[:text], Mime[:svg] ]
|
3
4
|
|
4
5
|
attr_reader :load_path, :output_path, :compilers
|
5
6
|
|
@@ -41,10 +42,6 @@ class Propshaft::Processor
|
|
41
42
|
compile_asset(asset) || copy_asset(asset)
|
42
43
|
end
|
43
44
|
|
44
|
-
def copy_asset(asset)
|
45
|
-
FileUtils.copy asset.path, output_path.join(asset.digested_path)
|
46
|
-
end
|
47
|
-
|
48
45
|
def compile_asset(asset)
|
49
46
|
File.open(output_path.join(asset.digested_path), "w+") do |file|
|
50
47
|
begin
|
@@ -56,10 +53,13 @@ class Propshaft::Processor
|
|
56
53
|
end if compilers.compilable?(asset)
|
57
54
|
end
|
58
55
|
|
56
|
+
def copy_asset(asset)
|
57
|
+
FileUtils.copy asset.path, output_path.join(asset.digested_path)
|
58
|
+
end
|
59
|
+
|
59
60
|
|
60
61
|
def compress_assets
|
61
|
-
|
62
|
-
load_path.assets.each do |asset|
|
62
|
+
load_path.assets(content_types: COMPRESSABLE_CONTENT_TYPES).each do |asset|
|
63
63
|
compress_asset output_path.join(asset.digested_path)
|
64
64
|
end if compressor_available?
|
65
65
|
end
|
data/lib/propshaft/version.rb
CHANGED