Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EJS support #10

Open
cookie-ag opened this issue Aug 27, 2016 · 5 comments
Open

EJS support #10

cookie-ag opened this issue Aug 27, 2016 · 5 comments

Comments

@cookie-ag
Copy link

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?

@ethanresnick
Copy link
Collaborator

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.

@paulwalker
Copy link
Owner

this is settable in the options but perhaps it's best to allow for an ENV var?

@ethanresnick
Copy link
Collaborator

Not sure I understand... what is settable in options?

@ethanresnick ethanresnick reopened this Nov 26, 2016
@paulwalker
Copy link
Owner

paulwalker commented Nov 26, 2016

the public directory. but if there is code that does not recognize this setting, that is a bug.

@ethanresnick
Copy link
Collaborator

ethanresnick commented Nov 26, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants