Adding etag to public folder assets

Hey there, I found that I can’t dymically import CSS (this has already been discussed here somewhere I think) so I have not put some css files in the public folder. However, I need to add the eTag.

The docs show this approach for serving a static html page but I wonder how to define WebApp to only trigger the middleware for files in the public folder?

One thing that comes to mind if having a special text on the folders under public folder (or even add a one level folder for all with a special folder name)

Next is to have a list of folders that can be used by the webapp

Dynamically importing CSS is very easy you can just import the file with require and it will be added to the output. Adding conditionals based on route is not an issue either.

What I have found is more optimal is to simply include the file in your html before react is initiated as this will work with browser level caching very nicely. eTag is used for caching and set by the web server, nginx now sets it by default.

For example in your nginx conf

location /css {
    root /path/to/public/css;
}

Will have etags enabled by default.

Of course if you do not run your own servers you will not be able to access this functionality as it will be obfuscated from you behind their web GUI. You will most probably need SSH access to set this up.