You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `:to` parameter is only required if you want to change the destination logical import name. If you drop the :to option, you must place the :under option directly after the first parameter.
88
89
89
-
The `integrity: true` option automatically calculates integrity hashes for all files in the directory, providing security benefits without manual hash management.
90
+
The `enable_integrity!` call enables integrity calculation globally, and `integrity: true` automatically calculates integrity hashes for all files in the directory, providing security benefits without manual hash management.
Starting with importmap-rails, **`integrity: true` is the default**for all pins. This automatically calculates integrity hashes for local assets served by the Rails asset pipeline:
146
+
To enable automatic integrity calculation for local assets served by the Rails asset pipeline, you must first call `enable_integrity!` in your importmap configuration:
146
147
147
148
```ruby
148
149
# config/importmap.rb
149
150
150
-
# These all use integrity: true by default
151
+
# Enable integrity calculation globally
152
+
enable_integrity!
153
+
154
+
# With integrity enabled, these will auto-calculate integrity hashes
@@ -163,7 +167,7 @@ This is particularly useful for:
163
167
***Bulk operations** with `pin_all_from` where calculating hashes manually would be tedious
164
168
***Development workflow** where asset contents change frequently
165
169
166
-
This behavior can be disabled by setting `integrity: false` or `integrity: nil`
170
+
**Note:** Integrity calculation is opt-in and must be enabled with `enable_integrity!`. This behavior can be further controlled by setting `integrity: false` or `integrity: nil` on individual pins.
167
171
168
172
**Important for Propshaft users:** SRI support requires Propshaft 1.2+ and you must configure the integrity hash algorithm in your application:
0 commit comments