As I dive deeper into using pug, I have come across something called mixins
What are Mixins?
Mixin my sweat and tears into a cake *Awkward Silence*. Any who, mix ins are pieces of code that are reusable in a given file. They help push the DRY principle so that you don't have to use the same block of code time and time again.
✅ Just like functions, mixins have a name we can provide them as well as parameters which we set up. In turn they return the code block containing the provided information.
✅ We then access them by calling them into our content using + prefix alongside the mixin name and then providing the needed arguments
🚀Boom, Ansnakech is your aunt. You have 50 lines of code condensed into 5.
P.S If you've read the entire segment, you can also have JavaScript Code included using the - prefix which hides it from being rendered. This is called unbuffered code
What are Mixins?
Mixin my sweat and tears into a cake *Awkward Silence*. Any who, mix ins are pieces of code that are reusable in a given file. They help push the DRY principle so that you don't have to use the same block of code time and time again.
✅ Just like functions, mixins have a name we can provide them as well as parameters which we set up. In turn they return the code block containing the provided information.
✅ We then access them by calling them into our content using + prefix alongside the mixin name and then providing the needed arguments
🚀Boom, Ansnakech is your aunt. You have 50 lines of code condensed into 5.
P.S If you've read the entire segment, you can also have JavaScript Code included using the - prefix which hides it from being rendered. This is called unbuffered code