diff --git a/system/config/system.yaml b/system/config/system.yaml
index a5eec78fe..684e3bbbd 100644
--- a/system/config/system.yaml
+++ b/system/config/system.yaml
@@ -56,6 +56,7 @@ assets: # Configuration for Assets Manager (JS, C
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
js_minify: true # Minify the JS during pipelining
+ enable_asset_timestamp: true # Enable asset timetsamps
collections:
jquery: system://assets/jquery/jquery-2.1.3.min.js
diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php
index a63a08d3d..3b232f457 100644
--- a/system/src/Grav/Common/Assets.php
+++ b/system/src/Grav/Common/Assets.php
@@ -71,6 +71,7 @@ class Assets
// Some configuration variables
protected $config;
protected $base_url;
+ protected $timestamp = '';
// Default values for pipeline settings
protected $css_minify = true;
@@ -82,7 +83,6 @@ class Assets
protected $css_no_pipeline = array();
protected $js_no_pipeline = array();
-
public function __construct(array $options = array())
{
// Forward config options
@@ -154,6 +154,12 @@ class Assets
}
}
+ // Set timestamp
+ if (isset($config['enable_asset_timestamp']) && $config['enable_asset_timestamp'] === true) {
+ $this->timestamp = '?' . self::getGrav()['cache']->getKey();
+ }
+
+
return $this;
}
@@ -422,11 +428,11 @@ class Assets
$output .= '' . "\n";
foreach ($this->css_no_pipeline as $file) {
- $output .= '' . "\n";
+ $output .= '' . "\n";
}
} else {
foreach ($this->css as $file) {
- $output .= '' . "\n";
+ $output .= '' . "\n";
}
}
@@ -480,11 +486,11 @@ class Assets
if ($this->js_pipeline) {
$output .= '' . "\n";
foreach ($this->js_no_pipeline as $file) {
- $output .= '' . "\n";
+ $output .= '' . "\n";
}
} else {
foreach ($this->js as $file) {
- $output .= '' . "\n";
+ $output .= '' . "\n";
}
}