-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible add a transformation without any associated attribute? #36
Comments
@andrewaguiar No, sorry. It's not possible, but I'm open to changing the gem to accommodate "static" custom transformations. As a workaround I suggest rewriting your transformation like this: class SetFocusableTransform < InlineSvg::CustomTransformation
def transform(doc)
svg = doc.at_css('svg')
svg['focusable'] = !!value.to_s
doc
end
end Configure it like this: InlineSvg.configure do |config|
config.add_custom_transformation(attribute: :focusable, transform: SetFocusableToFalseTransform)
end And use it like this: inline_svg('some-document.svg', focusable: true)
inline_svg('some-document.svg', focusable: false) |
@jamesmartin I sent a PR with an implementation of somthing that can be used to do this #37 Thanks |
Fixed in v0.8.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible add a transformation without any associated attribute? For instance, I would like to add a transformation to every svg without a specific attribute eg:
and the transformation
Thanks
The text was updated successfully, but these errors were encountered: