Wallogit.com
2017 © Pedro Peláez
This package can be used to force browser refresh of assets when cached in the users browser utilising an asset versioning technique.
This package can be used to force browser refresh of assets when cached in the users browser utilising an asset versioning technique. The version number used is the assets last modified timestamp., (*1)
Installing Composer.., (*2)
$ curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer
You are not obliged to move the composer.phar file to your /usr/local/bin, it is however considered easy to have an global installation., (*3)
Add the following to your require block in composer.json config, (*4)
"roliod/codeigniter-asset-versioning": "^1.0"
If your new to composer and have no clue what I'm talking about, (*5)
Just create a file named composer.json in your document root:, (*6)
{
"require": {
"roliod/codeigniter-asset-versioning": "^1.0"
}
}
Now let's install the package:, (*7)
composer install
You can also install by using:, (*8)
composer require roliod/codeigniter-asset-versioning
Lastly, run this command when the package has been successfully installed:, (*9)
php vendor/roliod/codeigniter-asset-versioning/install.php
That's all !, (*10)
The autoload file is located at application/config/, (*11)
$autoload['libraries'] = array('asset');, (*12)
$autoload['helpers'] = array('asset');, (*13)
The config file is located at application/config/, (*14)
$config['base_url'] = 'https://mywebsite.com', (*15)
<link href="<?php echo version_url('path/to/css/file') ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo version_url('path/to/js/file') ?>" type="text/javascript"></script>