Is is possible to add a bespoke Twig template loader? Twig lets you provide alternate (or multiple) template loaders. I'd like to take advantage of this to do use a bespoke loader to pull in components from a pattern library using a shorthand syntax like {% include '*mycomponent' %} or similar.

Does Craft expose the environment used for loading templates in a way that I can append/overwrite the default filesystem loader with my own custom implementation?

Any pointers in the right direction would be much appreciated!
When you call Craft's TemplatesService-&gt;getTwig()  (craft()-&gt;templates-&gt;getTwig()), the first parameter you can pass in is your custom template loader classname.

i.e. craft()-&gt;templates-&gt;getTwig('\My\Awesome\Plugin\TemplateLoader, array('my' =&gt; 'options')