A Craft CMS plugin for reading a revision string from a file and provide it as template-variable. This is useful for deploying the cms with capistrano or something else.
-
Download ZIP and unzip file then place the
revision
directory into yourcraft/plugins
directory. -
Install the plugin through Control Panel under
Settings > Plugins
Create a revision.php
file in your craft/config
directory and set the path to your REVISION file, relative to your index.php
<?php
return array(
'revisionFile' => '../REVISION',
);
in your templates you can use it like this:
<script src="main.js?v={{ craft.revision.get }}"></script>
or
<script src="main.js?v={{ craft.revision.lastTimeModified.getTimestamp() }}"></script>
varName | type | description |
---|---|---|
craft.revision.get | string | the content of your revisionFile |
craft.revision.lastTimeModified | DateTime | the last modified DateTime of your revisionFile |