Skip to content

Commit

Permalink
asset url timestamp feature
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w committed Jul 13, 2022
1 parent ff84934 commit 50b2703
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Zusätzliche hartkodierte Links zu Dateien, die auf jeder Seite sofort geladen w

Zusätzliche hartkodierte Links zu Dateien, die auf jeder Seite früh vorausgeladen werden sollen.

### Assets-Optimierung (alias "Cache-Buster")

## Fragen und Wissenswertes

### Wie funktioniert prefetching?
Expand Down
16 changes: 16 additions & 0 deletions lib/speed_up_asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

class speed_up_asset {
public static function getUrl($file, $show_timestamp = true)
{
if ($show_timestamp) {
$timestamp = '?timestamp='.filemtime(rex_path::assets($file));
}

return rex_url::assets($file) . $timestamp;
}

public static function showUrl($file, $show_timestamp = true) {
echo self::getUrl($file, $show_timestamp);
}
}
7 changes: 4 additions & 3 deletions package.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package: speed_up
version: '1.1.5'
version: '1.2'
author: 'Alexander Walther'
supportpage: https://www.alexplus.de

requires:
redaxo: ^5.6
yrewrite: ^2
redaxo: ^5.10
yrewrite: ^2.7
metainfo: ^2

page:
Expand All @@ -21,3 +21,4 @@ default_config:
profile: 'auto'
prefetch: '<!--<link rel="prefetch" href="/pfad/zu/meiner/datei.ext">-->'
preload: '<!--<link rel="preload" href="/pfad/zu/meiner/datei.ext">-->'
cache_warmup: 'auto'
2 changes: 1 addition & 1 deletion pages/system.speed_up.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
};
?>
</div>
</div>
</div>

0 comments on commit 50b2703

Please sign in to comment.