sprockets-rails 3.4.1 → 3.4.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
2
  SHA256:
3
- metadata.gz: 6be530b798270a9a8b0590e0faecb2189cd3c0c6b921c483c7361831885b1a5a
4
- data.tar.gz: '09b0e1f10512e0c51797736ea6eae9c79d174b45897b54326ae22aabc8773277'
3
+ metadata.gz: 73feab57944f69ac95583179fd64af5d7e927b6e352260ce8d061e95b2dbdfd8
4
+ data.tar.gz: 4cec001efd7cd64ee755114ccdaa80dac093abf39efd0e982223329508e3ddb1
5
5
  SHA512:
6
- metadata.gz: 37622f84b510b136e07544cee58151e02dc2db4ab489255afbfacc8e51b2f50a6751beeaec3c96b585b249f9f654fa8357c6caca8d07337a7d1400d624f31950
7
- data.tar.gz: 159688118eab9c77ba8820895324fbd6b13cf7c28d5626c1fb56fa3bb8dc71274f5a0422b742e3136d55a41ba2711258d881d2005d0cdeeef6fb0f766c3380c5
6
+ metadata.gz: 551eeb4f6d09b58157c6fbe2797f4e7ec69dde50cb9a160862e75cd2fe73063e1935582e3bf69533a835d3045d8562ce73de636caa89320e0d1a8b19cb875326
7
+ data.tar.gz: 2ea2f80c41a29207772023a344a5404d0aeae3c32987c5dae511f7941637a3ac744e02d66681d667e1b583fe91b2b606c43ab708436766cf708a76408628cb42
data/README.md CHANGED
@@ -86,7 +86,7 @@ When enabled, fingerprints will be added to asset filenames.
86
86
 
87
87
  **`config.assets.debug`**
88
88
 
89
- Enable expanded asset debugging mode. Individual files will be served to make referencing filenames in the web console easier. This feature will eventually be deprecated and replaced by Source Maps in Sprockets 3.x.
89
+ Enable asset debugging mode. A source map will be included with each asset when this is true.
90
90
 
91
91
  **`config.assets.compile`**
92
92
 
@@ -108,6 +108,10 @@ config.assets.configure do |env|
108
108
  end
109
109
  ```
110
110
 
111
+ **`config.assets.resolve_assets_in_css_urls`**
112
+
113
+ When this option is enabled, sprockets-rails will register a CSS postprocessor to resolve assets referenced in [`url()`](https://developer.mozilla.org/en-US/docs/Web/CSS/url()) function calls and replace them with the digested paths. Defaults to `true`.
114
+
111
115
  **`config.assets.resolve_with`**
112
116
 
113
117
  A list of `:environment` and `:manifest` symbols that defines the order that
@@ -1,8 +1,8 @@
1
1
  module Sprockets
2
2
  module Rails
3
- # Rewrites urls in CSS files with the digested paths
3
+ # Resolve assets referenced in CSS `url()` calls and replace them with the digested paths
4
4
  class AssetUrlProcessor
5
- REGEX = /url\(\s*["']?(?!(?:\#|data|http))(?<relativeToCurrentDir>.\/)?(?<path>[^"'\s)]+)\s*["']?\)/
5
+ REGEX = /url\(\s*["']?(?!(?:\#|data|http))(?<relativeToCurrentDir>\.\/)?(?<path>[^"'\s)]+)\s*["']?\)/
6
6
  def self.call(input)
7
7
  context = input[:environment].context_class.new(input)
8
8
  data = input[:data].gsub(REGEX) do |_match|
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Rails
3
- VERSION = "3.4.1"
3
+ VERSION = "3.4.2"
4
4
  end
5
5
  end
@@ -97,12 +97,13 @@ module Sprockets
97
97
  end
98
98
 
99
99
  config.assets = OrderedOptions.new
100
- config.assets._blocks = []
101
- config.assets.paths = []
102
- config.assets.precompile = []
103
- config.assets.prefix = "/assets"
104
- config.assets.manifest = nil
105
- config.assets.quiet = false
100
+ config.assets._blocks = []
101
+ config.assets.paths = []
102
+ config.assets.precompile = []
103
+ config.assets.prefix = "/assets"
104
+ config.assets.manifest = nil
105
+ config.assets.quiet = false
106
+ config.assets.resolve_assets_in_css_urls = true
106
107
 
107
108
  initializer :set_default_precompile do |app|
108
109
  if using_sprockets4?
@@ -120,7 +121,9 @@ module Sprockets
120
121
  end
121
122
 
122
123
  initializer :asset_url_processor do |app|
123
- Sprockets.register_postprocessor "text/css", ::Sprockets::Rails::AssetUrlProcessor
124
+ if app.config.assets.resolve_assets_in_css_urls
125
+ Sprockets.register_postprocessor "text/css", ::Sprockets::Rails::AssetUrlProcessor
126
+ end
124
127
  end
125
128
 
126
129
  initializer :asset_sourcemap_url_processor do |app|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2021-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []
149
- rubygems_version: 3.2.22
149
+ rubygems_version: 3.2.32
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: Sprockets Rails integration