asset_packer 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/asset_packer/processor/local.rb +20 -2
- data/lib/asset_packer/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e62a6ebdeaf1783811d5bd24b8eee4ffa8a5db4cd6820cac6109d101475f3cac
|
4
|
+
data.tar.gz: 787c21b934a4181694eabd2702926536602e044e93202d019ea680197f35932f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e74ad5dfb8e9438770012adfbfbe143702f7855f44a5876ffda0841a9c5b32711e5fe5d6faddcacfd79bae9d6ec227320aa4cbde6327b7ad27a9c87f7fc6ec26
|
7
|
+
data.tar.gz: d9ebfbf89e1986235e1b00b4ac24c07093b2c9ce9758fa6c28a025cf873ff9c9664665f7a9e984a3c2dab7936b910112c8a6fc447977b4622010d87fc678732a
|
@@ -40,7 +40,25 @@ module AssetPacker
|
|
40
40
|
class Stylesheet < self
|
41
41
|
def call(doc)
|
42
42
|
doc.replace('link[rel=stylesheet]') do |link|
|
43
|
-
link.attr(:href, save_asset(link[:href], 'css', &
|
43
|
+
link.attr(:href, save_asset(link[:href], 'css', &extract_references(link[:href])))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def extract_references(base_url)
|
48
|
+
->(content) do
|
49
|
+
content = extract_imports(base_url)[content]
|
50
|
+
extract_css_links(base_url)[content]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def extract_imports(base_url)
|
55
|
+
->(content) do
|
56
|
+
content.gsub(/@import\s+['"]([^'"]+)['"]\s*(\w*);/) {
|
57
|
+
path, type = $1, $2
|
58
|
+
uri = URI.join(full_source_uri, base_url, path)
|
59
|
+
block = extract_references(uri)
|
60
|
+
"@import '../#{ save_asset(uri, 'css', &block) }' #{type};"
|
61
|
+
}
|
44
62
|
end
|
45
63
|
end
|
46
64
|
|
@@ -52,7 +70,7 @@ module AssetPacker
|
|
52
70
|
# TODO check for media type, not URL
|
53
71
|
# using regex instead of checking ext because
|
54
72
|
# google font files don't work otherwise
|
55
|
-
block =
|
73
|
+
block = extract_references(uri) if uri.to_s =~ /css/
|
56
74
|
"url(../#{ save_asset(uri, ext, &block) })"
|
57
75
|
}
|
58
76
|
end
|
data/lib/asset_packer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_packer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arne Brasseur
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hexp
|
@@ -142,7 +142,7 @@ homepage: https://github.com/plexus/asset_packer
|
|
142
142
|
licenses:
|
143
143
|
- MIT
|
144
144
|
metadata: {}
|
145
|
-
post_install_message:
|
145
|
+
post_install_message:
|
146
146
|
rdoc_options: []
|
147
147
|
require_paths:
|
148
148
|
- lib
|
@@ -157,9 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
|
161
|
-
|
162
|
-
signing_key:
|
160
|
+
rubygems_version: 3.1.4
|
161
|
+
signing_key:
|
163
162
|
specification_version: 4
|
164
163
|
summary: Create an offline version of a HTML file.
|
165
164
|
test_files:
|