connect-static-expiry
connect-static-expiry copied to clipboard
EJS support
I did the config as follows
app.use(expiry(app, {
dir: path.join(__dirname, 'public'),
duration: 31556900
}));
app.use(express.static(path.join(__dirname, 'public'), {
maxage: config.oneDay
}, {
etag: config.etagAllow
}, {
dotfiles: config.Allowdotfiles
}));
and defined the route as <link rel="stylesheet" type="text/css" href="<%= furl(../vendor/main_Lib.min.css) %>">
but the resource fails to load?
Without more context, it's hard to know what's going on here. However, the most likely culprit is the ../vendor
. The furl
function expects the public, root-relative url for the file, just without the fingerprint, not the path to the file on disk.
this is settable in the options but perhaps it's best to allow for an ENV var?
Not sure I understand... what is settable in options?
the public directory. but if there is code that does not recognize this setting, that is a bug.
You're talking about the dir
setting, right? If so, yeah, that sets where to find the static files on disk, and it is being used to locate the files for fingerprinting.
My point was that the furl()
function's argument isn't the path to the file on disk, but is rather the url for the file, just without the fingerprint. (In the issue report, it looked like @serganus was trying to pass the path to furl). Are you saying that furl should accept a path too, or we should make that configurable? If so, I'm not opposed (and maybe it's more intuitive?), though I don't really see why it'd be necessary either.