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

path ignored for unversioned files #36

Open
benmccann opened this issue Aug 1, 2019 · 1 comment
Open

path ignored for unversioned files #36

benmccann opened this issue Aug 1, 2019 · 1 comment

Comments

@benmccann
Copy link

I include staticify like this:

const staticify = require('staticify')(path.join(__dirname, 'public'), { pathPrefix: '/public' });
app.use('/public', staticify.middleware);

This works when I receive requests for versioned files, but not if I request the file without including the hash

I can work around the issue using the code below, but it'd be nice if staticify.middleware did this for me

    if (!isProd) {    
        app.use(function(req, res, next) {
            if (req.url.startsWith('/javascripts') || req.url.startsWith('/css')) {
                req.url = '/public/' + req.url;
            }
            next();
        });
    }
@XhmikosR
Copy link
Collaborator

If you make a PR with tests, someone will be able to review it :)

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

2 participants