hjeti / vue-skeleton

A Vue skeleton
MIT License
108 stars 21 forks source link

Don't output webpack generated assets in a version number folder #57

Open flut1 opened 6 years ago

flut1 commented 6 years ago

We are already using hash filenaming for some assets. Which is great, because this optimizes caching: changed files get a different filename but assets that have not changed will still have the same path so they are cached by the browser. However, by putting assets in a /version/xxxx folder the path will change on every build, regardless of the contents of the asset has changed. This makes the hash in the filename redundant.

hjeti commented 6 years ago

We can do it but assets that are in the static folder will not be versioned when we change this and can be cached by the server. So we need a solution for those files. We can maybe add a hash to the static folder so they are never cached.

ThaNarie commented 6 years ago

It's fine to have both, a version folder for static content (images, json, videos) that is loaded by html or xhr requests, and have the asset folder outputted by webpack with a hash in the filename.

Only thing that needs to be done is having a proper cleanup script that uses information from each build to know which files aren't used anymore in the recent X builds. We already have something for another project, and could make that available as node module to include here as well.

flut1 commented 6 years ago

@hjeti All assets should still be versioned either by a version number folder or hash versioning. To clarify, this is my suggestion:

flut1 commented 5 years ago

@hjeti I have this ready now but it's waiting for #82. Can you merge it so I can create a new PR? All outstanding comments have been resolved.

hjeti commented 5 years ago

@flut1 I've merged your PR