You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to Plugin Basics > Timestamps any asset included inside a plugin folder should automatically receive a timestamp when cached in the media folder. This is not happening, and it seems this has not worked for several years:
Expected behavior
Referring to an asset included inside a plugin should return a URL that points to a cached file which has a URL such as this: /media/plugins/superwoman/superplugin/myCss.1520265293.css
Actual Behavior
The actual result of referring to an asset inside a plugin folder is: /media/plugins/superwoman/superplugin/myCss.css
Screenshots
To reproduce
Go to create a plugin and add a CSS file inside the asset folder of your plugin
Include the CSS file in a page template using css('PATH')
Open a page using this template
Look for the <link>-tag in the HTML
Your setup
Kirby v3.9.1
Console output
Your system (please complete the following information)
PHP: 8.1.17
Additional context
The text was updated successfully, but these errors were encountered:
stairjoke
changed the title
Plugin asset CSS files are miss timestamp in URL
Plugin asset CSS files miss timestamp in URL
May 4, 2023
@lukasbestle I think even with our changes #5247 this remains too complicated for developers. I think we need to rewrite it once more to allow something like
$plugin->asset('foo.js')->url();
// -> URL to media folder with timestamp included (based on modified)// maybe also more methods$plugin->asset('foo.js')->exists();
$plugin->asset('foo.js')->publish();
$plugin->asset('foo.js')->unpublish();
$plugin->asset('foo.js')->path();
$plugin->asset('foo.js')->root();
Unfortunately, I think Filesystem\Asset is currently very much tied to the assets folder. Ideally, we'd make that class more flexible as well and reuse here.
@distantnative I like that syntax. However I wouldn't add ->exists(), IMO the asset() method should still return null if the asset does not exist. Otherwise it would be really hard to find bugs because the asset URL would still be generated and one would have to search for reasons why the URL doesn't work. If it returns null, there's immediately an error.
Description
According to Plugin Basics > Timestamps any asset included inside a plugin folder should automatically receive a timestamp when cached in the media folder. This is not happening, and it seems this has not worked for several years:
Expected behavior
Referring to an asset included inside a plugin should return a URL that points to a cached file which has a URL such as this:
/media/plugins/superwoman/superplugin/myCss.1520265293.css
Actual Behavior
The actual result of referring to an asset inside a plugin folder is:
/media/plugins/superwoman/superplugin/myCss.css
Screenshots
To reproduce
css('PATH')
<link>
-tag in the HTMLYour setup
Kirby v3.9.1
Console output
Your system (please complete the following information)
Additional context
The text was updated successfully, but these errors were encountered: