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
If you define a mixin anywhere in content/_components/<your-component> it could become available in all templates.
This could be done by Bedrock scanning the contents of all files in _components and taking out any mixins, and then adding all those mixins to the global “namespace”.
The manual way to do right now is define mixins in content/_mixins/all manually. The problem with this is that it makes your code live both in _components and in _mixins.
It would be cleaner if there is a single place for your definition.
The text was updated successfully, but these errors were encountered:
Reading this idea a few months later it sounds a bit fragile, but co-location of code would still be nice, and would alllow you to work in Bedrock in a way that's more like in most modern JS frameworks.
Reading this again it sounds like it could make Bedrock slower if we are not careful.
One other implementation strategy might be to put the mixin in a specific format so that it becomes scannable. E.g. all mixins are in a filled called *.mixin.pug
And thus we can join the contents of all of these files and then make those mixins available in the global namespace.
However I don't think we can implement this without requiring a server restart.
Idea for Bedrock.
If you define a mixin anywhere in
content/_components/<your-component>
it could become available in all templates.This could be done by Bedrock scanning the contents of all files in
_components
and taking out any mixins, and then adding all those mixins to the global “namespace”.The manual way to do right now is define mixins in
content/_mixins/all
manually. The problem with this is that it makes your code live both in_components
and in_mixins
.It would be cleaner if there is a single place for your definition.
The text was updated successfully, but these errors were encountered: