Basic usage¶
Only include a file for use mixins located inside. You can do this specyfing pug includes at the beggining of your template.
For example if I have a file called example.pug
inside src/
folder and I need to use +script
mixin located at src/html/script.pug
:
include ./html/script.pug
See also
Custom contexts¶
Some mixins needs to pass specific locals at compilation script. For example, mixin +table-json()
needs a context with require
NodeJS function. The library includes some contexts in src/contexts.js
which can be imported in your preprocessing script:
-
pug_mixins_context
¶ All context included in
contexts.js
file merged in one context.
-
require_context
¶ Context with only
require
NodeJS function:{require: require}
.