diff --git a/lib/renderers.js b/lib/renderers.js
index <HASH>..<HASH> 100755
--- a/lib/renderers.js
+++ b/lib/renderers.js
@@ -206,10 +206,12 @@ function createCompiler(source, type) {
     return Bundler.fromFile(file, type).get;
   else  {
     var fn
-    if (source.template)
+    // Some templating engines (such as pug) require filenames in order to perform relative imports.
+    // We encourage compilers to use files if possible and templates only for basic use cases.
+    if (source.file)
+      fn = Pipelines.compileFile.bind(Pipelines, source.file.path);
+    else if (source.template)
       fn = Pipelines.compile.bind(Pipelines, source.ext, source.template);
-    else if (source.file)
-      fn = Pipelines.compileFile.bind(Pipelines, source.file);
     else
       throw new Error("Cannot create compiler due to invalid source");
Renderers#createRenderer: switching preference to files first to facilitate relative imports