 		res.locals.buildJsPath = (jsFile, opts = {})->
 			path = Path.join(jsPath, jsFile)
 
-			if opts.hashedPath
+			if opts.hashedPath && hashedFiles[path]?
 				path = hashedFiles[path]
 
 			if !opts.qs?


		res.locals.buildCssPath = (cssFile, opts)->
			path = Path.join("/stylesheets/", cssFile)
			if opts?.hashedPath
				hashedPath = hashedFiles[path]
				return Url.resolve(staticFilesBase, hashedPath)
			return Url.resolve(staticFilesBase, path)

	"/stylesheets/ol-style.css"
]

if !Settings.useMinifiedJs 
	logger.log "not using minified JS, not hashing static files"
else
	logger.log "Generating file hashes..."
	for path in pathList
		content = getFileContent(path)
		hash = crypto.createHash("md5").update(content).digest("hex")
		
		splitPath = path.split("/")
		filenameSplit = splitPath.pop().split(".")
		filenameSplit.splice(filenameSplit.length-1, 0, hash)
		splitPath.push(filenameSplit.join("."))

		hashPath = splitPath.join("/")
		hashedFiles[path] = hashPath

		fsHashPath = Path.join __dirname, "../../../", "public#{hashPath}"
		fs.writeFileSync(fsHashPath, content)


		logger.log "Finished hashing static content"

cdnAvailable = Settings.cdn?.web?.host?
darkCdnAvailable = Settings.cdn?.web?.darkHost?
