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
Support calculating integrity hashes for local assets automatically
When `integrity: true` is used with `pin_all_from` or `pin`, the importmap will automatically calculate integrity hashes for local assets served by the Rails asset pipeline. This eliminates the need to manually manage integrity hashes for local files, enhancing security and simplifying development.
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.
85
88
89
+
The `integrity: true` option automatically calculates integrity hashes for all files in the directory, providing security benefits without manual hash management.
90
+
86
91
Allows you to:
87
92
88
93
```js
@@ -181,6 +186,52 @@ If you have existing pins without integrity hashes, you can add them using the `
181
186
./bin/importmap integrity --update
182
187
```
183
188
189
+
### Automatic integrity for local assets
190
+
191
+
For local assets served by the Rails asset pipeline (like those created with `pin` or `pin_all_from`), you can use `integrity: true` to automatically calculate integrity hashes from the compiled assets:
192
+
193
+
```ruby
194
+
# config/importmap.rb
195
+
196
+
# Automatically calculate integrity from asset pipeline
0 commit comments