simplified buildJSPath

This commit is contained in:
Henry Oswald 2016-07-20 14:48:58 +01:00
parent a3e40adbaf
commit 596fc2525b
2 changed files with 5 additions and 6 deletions

View file

@ -71,15 +71,14 @@ module.exports = (app, webRouter, apiRouter)->
res.locals.buildJsPath = (jsFile, opts = {})->
p = Path.join(jsPath, jsFile)
doFingerPrint = opts.fingerprint != false
if !opts.qs?
opts.qs = {}
if !opts.fingerprint? and doFingerPrint
opts.fingerprint = getFingerprint(p)
else if doFingerPrint
opts.qs.fingerprint = opts.fingerprint
if !opts.qs?.fingerprint? and doFingerPrint
opts.qs.fingerprint = getFingerprint(p)
p = url.resolve(staticFilesBase, p)
qs = querystring.stringify(opts.qs)

View file

@ -129,7 +129,7 @@ block content
- var pdfPath = 'libs/pdfjs-1.3.91/pdf.worker.js'
- var fingerprintedPath = fingerprint(jsPath+pdfPath)
- var pdfJsWorkerPath = buildJsPath(pdfPath, {fingerprint:fingerprintedPath})
- var pdfJsWorkerPath = buildJsPath(pdfPath, {qs:{fingerprint:fingerprintedPath}})
script(type='text/javascript').