Replies: 1 comment 2 replies
-
we could even force defining all used variables in c-strict (if provided). as in the above example, we could make it so you'd have to use
otherwise the template would fail entirely, with "strict component uses undefined context variables". this could be a strong way of "forcing" the user to define all variables used in one place (making it easy for the consumer to tell whats used) and also to prevent them from forgetting to pass a variable this is especially useful as the components get more complex, and less useful for small components |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry for the discussion spam. Just an idea I had. Food for thought. I think implementation would be straightforward.
<c-strict />
💡 If this was added to a cotton component, the template would raise an exception on rendering if a variable was failed to be provided to the context. Ie
cotton/danger.html
This would be used as normal
But due to the presence of
<c-strict />
if it was invoked WITHOUT a keyword argument, it would raise an exception^ Would raise exception missing argument
object
Beta Was this translation helpful? Give feedback.
All reactions