lib/hanami/assets/helpers.rb in hanami-assets-0.3.0 vs lib/hanami/assets/helpers.rb in hanami-assets-0.4.0
- old
+ new
@@ -82,26 +82,31 @@
#
# It accepts one or more strings representing the name of the asset, if it
# comes from the application or third party gems. It also accepts strings
# representing absolute URLs in case of public CDN (eg. jQuery CDN).
#
- # If the "digest mode" is on, <tt>src</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>src</tt> is the fingerprinted
+ # version of the relative URL.
#
# If the "CDN mode" is on, the <tt>src</tt> is an absolute URL of the
# application CDN.
#
+ # If the "subresource integrity mode" is on, <tt>integriy</tt> is the
+ # name of the algorithm, then a hyphen, then the hash value of the file.
+ # If more than one algorithm is used, they'll be separated by a space.
+ #
# @param sources [Array<String>] one or more assets by name or absolute URL
#
# @return [Hanami::Utils::Escape::SafeString] the markup
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # at least one of the given sources is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the javascript file is missing
+ # from the manifest
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
# @see Hanami::Assets::Helpers#asset_path
#
# @example Single Asset
#
@@ -144,11 +149,11 @@
#
# <%= javascript 'https://code.jquery.com/jquery-2.1.4.min.js' %>
#
# # <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= javascript 'application' %>
#
# # <script src="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js" type="text/javascript"></script>
#
@@ -176,27 +181,32 @@
#
# It accepts one or more strings representing the name of the asset, if it
# comes from the application or third party gems. It also accepts strings
# representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
#
- # If the "digest mode" is on, <tt>href</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>href</tt> is the fingerprinted
+ # version of the relative URL.
#
# If the "CDN mode" is on, the <tt>href</tt> is an absolute URL of the
# application CDN.
#
+ # If the "subresource integrity mode" is on, <tt>integriy</tt> is the
+ # name of the algorithm, then a hyphen, then the hashed value of the file.
+ # If more than one algorithm is used, they'll be separated by a space.
# @param sources [Array<String>] one or more assets by name or absolute URL
#
# @return [Hanami::Utils::Escape::SafeString] the markup
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # at least one of the given sources is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the stylesheet file is missing
+ # from the manifest
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
+ # @see Hanami::Assets::Configuration#subresource_integrity
# @see Hanami::Assets::Helpers#asset_path
#
# @example Single Asset
#
# <%= stylesheet 'application' %>
@@ -226,11 +236,11 @@
#
# <%= stylesheet 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' %>
#
# # <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" rel="stylesheet">
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= stylesheet 'application' %>
#
# # <link href="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css" type="text/css" rel="stylesheet">
#
@@ -262,27 +272,29 @@
# representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
#
# <tt>alt</tt> Attribute is auto generated from <tt>src</tt>.
# You can specify a different value, by passing the <tt>:src</tt> option.
#
- # If the "digest mode" is on, <tt>src</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>src</tt> is the fingerprinted
+ # version of the relative URL.
#
# If the "CDN mode" is on, the <tt>src</tt> is an absolute URL of the
# application CDN.
#
# @param source [String] asset name or absolute URL
#
# @return [Hanami::Utils::Helpers::HtmlBuilder] the builder
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the image is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the image file is missing
+ # from the manifest
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
+ # @see Hanami::Assets::Configuration#subresource_integrity
# @see Hanami::Assets::Helpers#asset_path
#
# @example Basic Usage
#
# <%= image 'logo.png' %>
@@ -305,11 +317,11 @@
#
# <%= image 'https://example-cdn.com/images/logo.png' %>
#
# # <img src="https://example-cdn.com/images/logo.png" alt="Logo">
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= image 'logo.png' %>
#
# # <img src="/assets/logo-28a6b886de2372ee3922fcaf3f78f2d8.png" alt="Logo">
#
@@ -329,26 +341,27 @@
#
# If no argument is given, it assumes <tt>favico.ico</tt> from the application.
#
# It accepts one string representing the name of the asset.
#
- # If the "digest mode" is on, <tt>href</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>href</tt> is the fingerprinted version
+ # of the relative URL.
#
# If the "CDN mode" is on, the <tt>href</tt> is an absolute URL of the
# application CDN.
#
# @param source [String] asset name
#
# @return [Hanami::Utils::Helpers::HtmlBuilder] the builder
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the favicon is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the favicon is file missing
+ # from the manifest
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
# @see Hanami::Assets::Helpers#asset_path
#
# @example Basic Usage
#
@@ -366,11 +379,11 @@
#
# <%= favicon id: 'fav' %>
#
# # <link id: "fav" href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon">
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= favicon %>
#
# # <link href="/assets/favicon-28a6b886de2372ee3922fcaf3f78f2d8.ico" rel="shortcut icon" type="image/x-icon">
#
@@ -394,29 +407,30 @@
# representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
#
# Alternatively, it accepts a block that allows to specify one or more
# sources via the <tt>source</tt> tag.
#
- # If the "digest mode" is on, <tt>src</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>src</tt> is the fingerprinted
+ # version of the relative URL.
#
# If the "CDN mode" is on, the <tt>src</tt> is an absolute URL of the
# application CDN.
#
# @param source [String] asset name or absolute URL
#
# @return [Hanami::Utils::Helpers::HtmlBuilder] the builder
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the image is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the video file is missing
+ # from the manifest
#
# @raise [ArgumentError] if source isn't specified both as argument or
# tag inside the given block
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
# @see Hanami::Assets::Helpers#asset_path
#
# @example Basic Usage
#
@@ -487,11 +501,11 @@
#
# <%= video(content: true) %>
#
# # ArgumentError
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= video 'movie.mp4' %>
#
# # <video src="/assets/movie-28a6b886de2372ee3922fcaf3f78f2d8.mp4"></video>
#
@@ -512,29 +526,30 @@
# representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
#
# Alternatively, it accepts a block that allows to specify one or more
# sources via the <tt>source</tt> tag.
#
- # If the "digest mode" is on, <tt>src</tt> is the digest version of the
- # relative URL.
+ # If the "fingerprint mode" is on, <tt>src</tt> is the fingerprinted
+ # version of the relative URL.
#
# If the "CDN mode" is on, the <tt>src</tt> is an absolute URL of the
# application CDN.
#
# @param source [String] asset name or absolute URL
#
# @return [Hanami::Utils::Helpers::HtmlBuilder] the builder
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the image is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the audio file is missing
+ # from the manifest
#
# @raise [ArgumentError] if source isn't specified both as argument or
# tag inside the given block
#
# @since 0.1.0
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#cdn
# @see Hanami::Assets::Helpers#asset_path
#
# @example Basic Usage
#
@@ -605,11 +620,11 @@
#
# <%= audio(controls: true) %>
#
# # ArgumentError
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= audio 'song.ogg' %>
#
# # <audio src="/assets/song-28a6b886de2372ee3922fcaf3f78f2d8.ogg"></audio>
#
@@ -628,20 +643,21 @@
# It can be the name of the asset, coming from the sources or third party
# gems.
#
# Absolute URLs are returned as they are.
#
- # If Digest mode is on, it returns the digest path of the source
+ # If Fingerprint mode is on, it returns the fingerprinted path of the source
#
# If CDN mode is on, it returns the absolute URL of the asset.
#
# @param source [String] the asset name
#
# @return [String] the asset path
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the asset is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the asset is missing
+ # from the manifest
#
# @since 0.1.0
#
# @example Basic Usage
#
@@ -653,11 +669,11 @@
#
# <%= asset_path 'https://code.jquery.com/jquery-2.1.4.min.js' %>
#
# # "https://code.jquery.com/jquery-2.1.4.min.js"
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= asset_path 'application.js' %>
#
# # "/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js"
#
@@ -675,20 +691,21 @@
# It can be the name of the asset, coming from the sources or third party
# gems.
#
# Absolute URLs are returned as they are.
#
- # If Digest mode is on, it returns the digest URL of the source
+ # If Fingerprint mode is on, it returns the fingerprint URL of the source
#
# If CDN mode is on, it returns the absolute URL of the asset.
#
# @param source [String] the asset name
#
# @return [String] the asset URL
#
- # @raise [Hanami::Assets::MissingDigestAssetError] if digest mode is on and
- # the asset is missing from the manifest
+ # @raise [Hanami::Assets::MissingManifestAssetError] if `fingerprint` or
+ # `subresource_integrity` modes are on and the asset is missing
+ # from the manifest
#
# @since 0.1.0
#
# @example Basic Usage
#
@@ -700,10 +717,10 @@
#
# <%= asset_url 'https://code.jquery.com/jquery-2.1.4.min.js' %>
#
# # "https://code.jquery.com/jquery-2.1.4.min.js"
#
- # @example Digest Mode
+ # @example Fingerprint Mode
#
# <%= asset_url 'application.js' %>
#
# # "https://bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js"
#