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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 527c43f1a463148f3029d57500eb2e5edaac5cfb
4
- data.tar.gz: 5e86acbe5dc30daceafc4cd8adb6472c06a13bde
2
+ SHA256:
3
+ metadata.gz: e62a6ebdeaf1783811d5bd24b8eee4ffa8a5db4cd6820cac6109d101475f3cac
4
+ data.tar.gz: 787c21b934a4181694eabd2702926536602e044e93202d019ea680197f35932f
5
5
  SHA512:
6
- metadata.gz: f50bdf75f8679980cd00b515c775d651ace00eca0f369cc0763b525219a51349b687aef4bbe698c5e0efe01f5afb63eb4adeaa7bcef8a35f56225a0b68a062a4
7
- data.tar.gz: c7b50e50c06b6f1145b16a476396745e2ad5153757f29185ad4a33168e702ef11b5a067aa9ce448175f4a06cf0e837fcaeebadafb84b0068ec372e2836e3efbb
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', &extract_css_links(link[:href])))
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 = extract_css_links(uri) if uri.to_s =~ /css/
73
+ block = extract_references(uri) if uri.to_s =~ /css/
56
74
  "url(../#{ save_asset(uri, ext, &block) })"
57
75
  }
58
76
  end
@@ -1,3 +1,3 @@
1
1
  module AssetPacker
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
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.1
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: 2015-03-22 00:00:00.000000000 Z
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
- rubyforge_project:
161
- rubygems_version: 2.2.2
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: