Comments (2)
I wouldn't shard by file extension but rather just hash the filename and then take it (hash % 3) + 1
to get 1, 2, or 3. Of course it would be nice to configure the number of asset hosts and also the format used to generate the asset hostname. For example, you could use printf format like cdn%d.domain.com
and then use sprintf()
to get the asset host.
from laravel-cachebuster.
It would be a nice feature. Currently we configure a CDN via a string:
'cdn' => '//cdn.domain.com',
What if we could also specify a function? It would give you full control over the sharding logic, for example:
'cdn' => function($url, $hash) {
$shard = hexdec(substr($hash, -2, 2)) % 3 + 1;
return "cdn$shard.domain.com";
},
or
'cdn' => function($url, $hash) {
switch (pathinfo($url, PATHINFO_EXTENSION)) {
case 'css':
return "cdn1.domain.com";
case 'js':
return "cdn2.domain.com";
default:
return "cdn2.domain.com";
}
},
Anyone want to implement it?
from laravel-cachebuster.
Related Issues (13)
- CSS URL is made with MD5 hash, invalid link HOT 3
- Any chance of a tagged release version? HOT 8
- Laravel 5 support HOT 2
- Laravel-cachebuster conflicting with Croppa image file generation HOT 2
- Forced Clear on cache
- Laravel 5.3 Support? HOT 5
- Not working getting resource not available when hash key is added to js HOT 1
- Bust::url() gives error HOT 1
- Unable to load js files
- not working in Laravel 5.6.25 , composer not update it HOT 3
- 404 error on hyphenated filenames HOT 5
- NGINX Rules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-cachebuster.