asset_packer 0.3.0 → 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: ad692d5ed52ae6a35bd2bd7b45fe012ca08e70e5
4
- data.tar.gz: d0dcca9fe154df4e495a202fd6bab067c314abbd
2
+ SHA256:
3
+ metadata.gz: e62a6ebdeaf1783811d5bd24b8eee4ffa8a5db4cd6820cac6109d101475f3cac
4
+ data.tar.gz: 787c21b934a4181694eabd2702926536602e044e93202d019ea680197f35932f
5
5
  SHA512:
6
- metadata.gz: bdfbf09422db53bbd0d51deec44fb6c94ad39673dcaec12efe331e80ca2dc1c3f8086d51df5d66541909f4a3439a9a216a715d0edce2d5f7022d0f6bbb4ad818
7
- data.tar.gz: f2a2994f2de6ff7fccaf71015dbf3a543fcc3efa12a03bcb8a20235510febd7f70ef000fcacbf72c04d48e713132c1bf2c4782849f76ad45fad66f7e191b1fec
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
 
@@ -48,12 +66,11 @@ module AssetPacker
48
66
  ->(content) do
49
67
  content.gsub(/url\(['"]?([^\)'"]*)['"]?\)/) {
50
68
  uri = URI.join(full_source_uri, base_url, $1)
51
- puts uri
52
69
  ext = File.extname($1)[1..-1]
53
70
  # TODO check for media type, not URL
54
71
  # using regex instead of checking ext because
55
72
  # google font files don't work otherwise
56
- block = extract_css_links(uri) if uri.to_s =~ /css/
73
+ block = extract_references(uri) if uri.to_s =~ /css/
57
74
  "url(../#{ save_asset(uri, ext, &block) })"
58
75
  }
59
76
  end
@@ -1,3 +1,3 @@
1
1
  module AssetPacker
2
- VERSION = '0.3.0'
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.0
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: