Skip to content

Commit 9812ac6

Browse files
committed
remove laravel dep
rdme Update CacheBust.php
1 parent c704cdb commit 9812ac6

File tree

4 files changed

+13
-56
lines changed

4 files changed

+13
-56
lines changed

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1-
elixir among others create folders with the timestamp and then add the files to them,
2-
this makes it hard to maintain and just add unnecessary extra work.
3-
4-
this little package makes things much easier as you dont need to change anything in your workflow and everytime you make a change to the file, its timestamp gets changed automatically and so the cache will get busted 😍.
1+
simply everytime you make a change to the file, its timestamp gets changed & the cache will busted automatically 😍.
52

63
## Installation
74

85
- `composer require ctf0/asset-cache-bust`
96

10-
- add the service provider to `config/app.php`
11-
12-
```php
13-
'providers' => [
14-
ctf0\AssetCacheBust\AssetCacheBustServiceProvider::class,
15-
]
16-
```
17-
187
## Usage
198

209
- in your view
2110

2211
```blade
23-
// before
24-
{{ asset('css/style.css') }}
12+
// normal
13+
<?php echo bustfy('css/style.css') ?>
2514
26-
// after
15+
// laravel
2716
{{ bustfy('css/style.css') }}
2817
```
29-

composer.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"keywords": [
55
"ctf0",
66
"AssetCacheBust",
7-
"laravel"
7+
"cache-busting"
88
],
99
"homepage": "https://github.com/ctf0/AssetCacheBust",
1010
"license": "MIT",
@@ -15,20 +15,12 @@
1515
}
1616
],
1717
"require": {
18-
"illuminate/support": ">=4.2",
19-
"php" : "~7.0"
18+
"php" : ">=5.6"
2019
},
2120
"autoload": {
22-
"psr-4": {
23-
"ctf0\\AssetCacheBust\\": "src"
24-
}
25-
},
26-
"extra": {
27-
"laravel": {
28-
"providers": [
29-
"ctf0\\AssetCacheBust\\AssetCacheBustServiceProvider"
30-
]
31-
}
21+
"files": [
22+
"src/CacheBust.php"
23+
]
3224
},
3325
"config": {
3426
"sort-packages": true

src/AssetCacheBustServiceProvider.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/CacheBust.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

33
if (!function_exists('bustfy')) {
4-
function bustfy($file, $secure = null)
4+
function bustfy($file)
55
{
6-
$path = public_path($file);
6+
$path = getcwd() . "/$file";
77
$modification_time = filemtime($path);
8-
$render = "{$file}?v={$modification_time}";
8+
$render = "{$file}?v={$modification_time}";
99

10-
return app('url')->asset($render, $secure);
10+
return "/$render";
1111
}
1212
}

0 commit comments

Comments
 (0)