-
Notifications
You must be signed in to change notification settings - Fork 9
RenameAttr
M. Mikkel Rummelhoff edited this page Mar 5, 2018
·
1 revision
renameAttr lets you rename existing attributes for matching selectors, retaining the attribute values.
Rename the src
attribute to data-src
for all <img>
tags
{{ entry.body|retconRenameAttr('img', {src: 'data-src'}) }}
Rename the srcset
and sizes
attributes for all <img>
tags
{{ entry.body|retconRenameAttr('img', {srcset: 'data-srcset', sizes: 'data-sizes'}) }}
@selectors Mixed
String value or Array of string values
Examples: "p"
".foo"
"#bar"
"div.baz"
@attributes Array
Associative Array of existing attribute names and desired attribute names.