-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't add assets after update #117
Comments
I will take a look. |
Thank you. Just for reference the other plugin used |
Shortcode’s addAssets() function is mandatory because it does things differently to ensure the assets are added to the page meta data so they are not lost when the content is rendered and cached. |
I just tested with Shortcode-UI plugin which has various JS and CSS and it works fine even when cache is enabled: ...
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-accordion.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-tabs.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-browser.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-tooltips.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-callouts.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-cslider.css?g-ae33dc60" type="text/css" rel="stylesheet">
<link href="/grav-sandbox/user/plugins/shortcode-ui/css/ui-atext.css?g-ae33dc60" type="text/css" rel="stylesheet">
...
<script src="/grav-sandbox/user/plugins/shortcode-ui/js/ui-tabs.js?g-ae33dc60"></script>
<script src="/grav-sandbox/user/plugins/shortcode-ui/js/ui-tooltips.js?g-ae33dc60"></script>
<script src="/grav-sandbox/user/plugins/shortcode-ui/js/ui-cslider.js?g-ae33dc60"></script>
<script src="/grav-sandbox/user/plugins/shortcode-ui/js/ui-atext.js?g-ae33dc60"></script>
... And they are being added the same as you: $this->shortcode->getHandlers()->add('ui-animated-text', function(ShortcodeInterface $sc) {
// Add assets
$this->shortcode->addAssets('css', 'plugin://shortcode-ui/css/ui-atext.css');
$this->shortcode->addAssets('js', 'plugin://shortcode-ui/js/ui-atext.js');
.... Also nothing has really changed in either the Asset Manager or shortcode core when it comes to assets in a quite some time. Are you sure the assets you are linking actually exist? If the assets are not found, they will be skipped. |
Recently I updated both Grav (
v1.7.33
) and shortcode-core (v5.1.1
). Since then a third party plugin stopped working.It seems that shortcode-core doesn't load assets at all. On a clean plugin sample (using the
[strike]
shortcode from shortcode-core main page) I successfully get the formatted string (with<del>
) but trying to add assets (eitherjs
orcss
) doesn't seem to work.The code is really simple:
Only the
<del>
part gets successfully added and rendered.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: