cjrasmussen / static-file-versioning
Lightweight class that assists with versioning static asset files
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/cjrasmussen/static-file-versioning
Requires
- php: >=7.4
- ext-json: *
README
Lightweight class that assists with versioning static asset files. Designed to be integrated with a CI/CD pipeline.
Usage
Setting version
Ideally this is the part that would be integrated into a CI/CD pipeline.
use cjrasmussen\StaticFileVersioning\FileVersion; $fileVersion = new FileVersion('/path/to/config/file.json'); $fileVersion->set('styles.css', '-v1234'); $fileVersion->save();
Getting version
Likely used in building a view for a web interface.
use cjrasmussen\StaticFileVersioning\FileVersion; $fileVersion = new FileVersion('/path/to/config/file.json'); echo 'styles' . $fileVersion->get('styles.css') . '.css'; // output: styles-v1234.css
Installation
Simply add a dependency on cjrasmussen/static-file-versioning to your composer.json file if you use Composer to manage the dependencies of your project:
composer require cjrasmussen/static-file-versioning
Although it's recommended to use Composer, you can actually include the file(s) any way you want.
License
StaticFileVersioning is MIT licensed.