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
Copy file name to clipboardexpand all lines: README.md
+6
Original file line number
Diff line number
Diff line change
@@ -235,6 +235,12 @@ Using this option, you can re-enable it for selected visits:
235
235
236
236
Optional, Type: `boolean | string` – If you have [Accessibility Plugin](https://github.com/swup/a11y-plugin/) installed, you can adjust which element to focus for the visit [as described here](https://github.com/swup/a11y-plugin/#visita11yfocus).
237
237
238
+
#### rule.if
239
+
240
+
Optional, Type: `(visit) => boolean` – Provide a predicate function for fine-grained control over the matching behavior of a rule.
241
+
242
+
A predicate function that allows for fine-grained control over the matching behavior of a rule. This function receives the current [visit](https://swup.js.org/visit/) as a parameter, and must return a boolean value. If the function returns `false`, the rule is being skipped for the current visit, even if it matches the current route.
243
+
238
244
### debug
239
245
240
246
Type: `boolean`. Set to `true` for debug information in the console. Defaults to `false`.
expect(console.error).toBeCalledWith(newError('skipping rule since #fragment-1 doesn\'t exist in the current document'),expect.any(Object))// prettier-ignore
118
126
119
127
/** fragment element outside of swup's default containers */
expect(console.error).toBeCalledWith(newError('skipping rule since #fragment-1 is outside of swup\'s default containers'),expect.any(Object))// prettier-ignore
0 commit comments