locomotivemtl / locomotive-boilerplate

🚂 Front-end boilerplate for projects by Locomotive.
https://locomotivemtl-boilerplate.vercel.app/
MIT License
463 stars 71 forks source link

Improve asset versioning task #131

Closed mcaskill closed 1 year ago

mcaskill commented 2 years ago

Added:

Changed:

Regarding support for writing to the same file, one would generally only write a single version format. Just like before, there is still a risk of conflict if you are editing a file that might be being edited by another asynchronous task. For example, inserting the version number inside a CSS file that is generated by a Styles task.

Regarding using either a random hexadecimal value or a timestamp, it's more for personal preference.

Usage:

"versions": [
    {
        "format": "timestamp",
        "key": "now",
        "outfile": "./assets.json"
    },
    {
        "format": "hex:8",
        "key": "hex",
        "outfile": "./assets.json"
    }
]
{
    "now": 1665071717350,
    "hex": "6ef54181c4ba"
}