Why does Omeka-s add a ?v= variable to css and js scripts?

I can’t find where the verion is appended.

The php that loads the file via the Zend/Laminas is straightforward:

But the result in the element is:

The v= is the version of Foundation

But I can’t for the life of me find where it is being appended. Does anyone know?

I tried messing around with /application/src/View/Helper/AssetUrl.php but apparently the function I messed with wants 3 parameters.

Actually, just after posting this, I figured it out in a ridiculous hack-y way.

In AssetUrl.php, I changed this script in two places;

return sprintf(self::THEME_ASSETS_PATH, $basePath, $themeId,
$file, $versioned ? ‘?v=’ . $this->currentTheme->getIni(‘version’) : ‘’);

return sprintf(self::THEME_ASSETS_PATH, $basePath, $themeId,
$file, $versioned ? ‘’ : ‘’);

Essentially, just returning an empty string on both sides of the conditional.

Anyway, this is really hard to find and should probably be in one of the config files, but there might be good reasons it’s done this way.

If anyone has any thoughts or wants to tell me why I shouldn’t do this, please reply :slight_smile:

It’s cache busting. It forces the browser to reload the CSS file when a new theme version is released. Otherwise the browser will use the cached version, which is likely outdated.