hanami-assets 1.1.0 → 1.1.1
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 +5 -5
- data/CHANGELOG.md +7 -0
- data/lib/hanami/assets/bundler/compressor.rb +1 -1
- data/lib/hanami/assets/cache.rb +0 -1
- data/lib/hanami/assets/helpers.rb +44 -27
- data/lib/hanami/assets/precompiler.rb +1 -1
- data/lib/hanami/assets/version.rb +1 -1
- data/lib/hanami/assets.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8d71de2dd9edf00f8046d10907f60b555b0391d3079bc81b58bd88ec68d7eaf4
|
|
4
|
+
data.tar.gz: 823426740462f9e3d5a5357de6d6fe15d761dec2130e4e0363fe51f8b4ffebd7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6de7ae4f3605ea0ea0a823f14699ba8b6c4358652fb377e70af78fb5147ae33554352de2d40ba168c8039836f359c8769f44107d107cd1aa4cda7e04c6fb06b
|
|
7
|
+
data.tar.gz: fd1f5db6af660bfd1893495ce5059f915d8855c8b404fc648515dbadbcfc55d800f83867f9417f32a88399a86887d2a6b1da1cac07bd5b7e0af3233c697437c7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Hanami::Assets
|
|
2
2
|
Assets management for Ruby web applications
|
|
3
3
|
|
|
4
|
+
## v1.1.1 - 2018-02-27
|
|
5
|
+
### Added
|
|
6
|
+
- [Luca Guidi] Official support for Ruby: MRI 2.5
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- [Malina Sulca] Print `href` and `src` first in output HTML
|
|
10
|
+
|
|
4
11
|
## v1.1.0 - 2017-10-25
|
|
5
12
|
### Fixed
|
|
6
13
|
- [Luca Guidi] Don't let `#javascript` and `#stylesheet` helpers to append file extension if the URL contains a query string
|
|
@@ -46,7 +46,7 @@ module Hanami
|
|
|
46
46
|
# @api private
|
|
47
47
|
def _compress(compressor)
|
|
48
48
|
compressor.compress(@path)
|
|
49
|
-
rescue => e # rubocop:disable
|
|
49
|
+
rescue => e # rubocop:disable Style/RescueStandardError
|
|
50
50
|
warn(
|
|
51
51
|
[
|
|
52
52
|
"Skipping compression of: `#{@path}'",
|
data/lib/hanami/assets/cache.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require 'uri'
|
|
2
2
|
require 'set'
|
|
3
|
-
require 'thread'
|
|
4
3
|
require 'hanami/helpers/html_helper'
|
|
5
4
|
require 'hanami/utils/escape'
|
|
6
5
|
|
|
@@ -166,18 +165,22 @@ module Hanami
|
|
|
166
165
|
# <%= javascript 'application' %>
|
|
167
166
|
#
|
|
168
167
|
# # <script src="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js" type="text/javascript"></script>
|
|
169
|
-
def javascript(*sources, **options)
|
|
170
|
-
|
|
171
|
-
tag_options = options.dup
|
|
172
|
-
tag_options[:src] ||= _typed_asset_path(source, JAVASCRIPT_EXT)
|
|
173
|
-
tag_options[:type] ||= JAVASCRIPT_MIME_TYPE
|
|
168
|
+
def javascript(*sources, **options) # rubocop:disable Metrics/MethodLength
|
|
169
|
+
options = options.reject { |k, _| k.to_sym == :src }
|
|
174
170
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
_safe_tags(*sources) do |source|
|
|
172
|
+
attributes = {
|
|
173
|
+
src: _typed_asset_path(source, JAVASCRIPT_EXT),
|
|
174
|
+
type: JAVASCRIPT_MIME_TYPE
|
|
175
|
+
}
|
|
176
|
+
attributes.merge!(options)
|
|
177
|
+
|
|
178
|
+
if _subresource_integrity? || attributes.include?(:integrity)
|
|
179
|
+
attributes[:integrity] ||= _subresource_integrity_value(source, JAVASCRIPT_EXT)
|
|
180
|
+
attributes[:crossorigin] ||= CROSSORIGIN_ANONYMOUS
|
|
178
181
|
end
|
|
179
182
|
|
|
180
|
-
html.script(**
|
|
183
|
+
html.script(**attributes).to_s
|
|
181
184
|
end
|
|
182
185
|
end
|
|
183
186
|
|
|
@@ -253,19 +256,23 @@ module Hanami
|
|
|
253
256
|
# <%= stylesheet 'application' %>
|
|
254
257
|
#
|
|
255
258
|
# # <link href="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css" type="text/css" rel="stylesheet">
|
|
256
|
-
def stylesheet(*sources, **options) # rubocop:disable Metrics/
|
|
259
|
+
def stylesheet(*sources, **options) # rubocop:disable Metrics/MethodLength
|
|
260
|
+
options = options.reject { |k, _| k.to_sym == :href }
|
|
261
|
+
|
|
257
262
|
_safe_tags(*sources) do |source|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
attributes = {
|
|
264
|
+
href: _typed_asset_path(source, STYLESHEET_EXT),
|
|
265
|
+
type: STYLESHEET_MIME_TYPE,
|
|
266
|
+
rel: STYLESHEET_REL
|
|
267
|
+
}
|
|
268
|
+
attributes.merge!(options)
|
|
269
|
+
|
|
270
|
+
if _subresource_integrity? || attributes.include?(:integrity)
|
|
271
|
+
attributes[:integrity] ||= _subresource_integrity_value(source, STYLESHEET_EXT)
|
|
272
|
+
attributes[:crossorigin] ||= CROSSORIGIN_ANONYMOUS
|
|
266
273
|
end
|
|
267
274
|
|
|
268
|
-
html.link(**
|
|
275
|
+
html.link(**attributes).to_s
|
|
269
276
|
end
|
|
270
277
|
end
|
|
271
278
|
|
|
@@ -335,10 +342,15 @@ module Hanami
|
|
|
335
342
|
#
|
|
336
343
|
# # <img src="https://assets.bookshelf.org/assets/logo-28a6b886de2372ee3922fcaf3f78f2d8.png" alt="Logo">
|
|
337
344
|
def image(source, options = {})
|
|
338
|
-
options
|
|
339
|
-
options[:alt] ||= Utils::String.titleize(::File.basename(source, WILDCARD_EXT))
|
|
345
|
+
options = options.reject { |k, _| k.to_sym == :src }
|
|
340
346
|
|
|
341
|
-
|
|
347
|
+
attributes = {
|
|
348
|
+
src: asset_path(source),
|
|
349
|
+
alt: Utils::String.titleize(::File.basename(source, WILDCARD_EXT))
|
|
350
|
+
}
|
|
351
|
+
attributes.merge!(options)
|
|
352
|
+
|
|
353
|
+
html.img(attributes)
|
|
342
354
|
end
|
|
343
355
|
|
|
344
356
|
# Generate <tt>link</tt> tag application favicon.
|
|
@@ -397,11 +409,16 @@ module Hanami
|
|
|
397
409
|
#
|
|
398
410
|
# # <link href="https://assets.bookshelf.org/assets/favicon-28a6b886de2372ee3922fcaf3f78f2d8.ico" rel="shortcut icon" type="image/x-icon">
|
|
399
411
|
def favicon(source = DEFAULT_FAVICON, options = {})
|
|
400
|
-
options
|
|
401
|
-
|
|
402
|
-
|
|
412
|
+
options = options.reject { |k, _| k.to_sym == :href }
|
|
413
|
+
|
|
414
|
+
attributes = {
|
|
415
|
+
href: asset_path(source),
|
|
416
|
+
rel: FAVICON_REL,
|
|
417
|
+
type: FAVICON_MIME_TYPE
|
|
418
|
+
}
|
|
419
|
+
attributes.merge!(options)
|
|
403
420
|
|
|
404
|
-
html.link(
|
|
421
|
+
html.link(attributes)
|
|
405
422
|
end
|
|
406
423
|
|
|
407
424
|
# Generate <tt>video</tt> tag for given source
|
data/lib/hanami/assets.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hanami-assets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luca Guidi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: hanami-utils
|
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
245
245
|
version: '0'
|
|
246
246
|
requirements: []
|
|
247
247
|
rubyforge_project:
|
|
248
|
-
rubygems_version: 2.
|
|
248
|
+
rubygems_version: 2.7.5
|
|
249
249
|
signing_key:
|
|
250
250
|
specification_version: 4
|
|
251
251
|
summary: Assets management
|