Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (27 sloc) 0.944 kb
# Requires
pathUtil = require('path')
fsUtil = require('fs')
{DocPad,queryEngine,Backbone,createInstance} = require(__dirname+'/lib/docpad')
# Export
module.exports =
# Pre-Defined
DocPad: DocPad
queryEngine: queryEngine
Backbone: Backbone
createInstance: createInstance
# Require a local DocPad file
require: (relativePath) ->
# Absolute the path
absolutePath = pathUtil.normalize(pathUtil.join(__dirname,relativePath))
# now check we if are actually a local docpad file
if absolutePath.replace(__dirname,'') is absolutePath
throw new Error("docpad.require is limited to local docpad files only: #{relativePath}")
# now check if the path actually exists
# if it doesn't exist, then try add the lib directory
catch err
absolutePath = pathUtil.join(__dirname,'lib',relativePath)
# finally, require the path
return require(absolutePath)
Jump to Line
Something went wrong with that request. Please try again.