Skip to content
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

Document passing attributes #17

Open
yoanmalie opened this issue Apr 21, 2020 · 4 comments
Open

Document passing attributes #17

yoanmalie opened this issue Apr 21, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@yoanmalie
Copy link

yoanmalie commented Apr 21, 2020

Hello,

I'm trying your (great!) plugin for a new website. And at first the debugger throw me an error because it's looked like I can't replace this line:
<?= css('/assets/css/print.css', 'print') ?>

By:
<?= Bnomei\Fingerprint::css('/assets/css/print.css', 'print') ?>

Argument 3 passed to Bnomei\Fingerprint::helper() must be of the type array, string given, called in /Users/yoan/Projets/zardust/site/plugins/kirby3-fingerprint/classes/Fingerprint.php on line 218

By looking the error and the plugin code, I understand that the attributes need to be passed through an array. I think a common example with media="print" should be useful on the documentation 👍

Thanks!

@bnomei bnomei self-assigned this May 11, 2020
@bnomei bnomei added the enhancement New feature or request label May 11, 2020
@bnomei
Copy link
Owner

bnomei commented May 11, 2020

ah. the kirby css helper does support a string with media as default. i did not know that.
https://getkirby.com/docs/reference/templates/helpers/css

also the js uses bool for async
https://getkirby.com/docs/reference/templates/helpers/js#example__async

i will see if i can get my helpers working more closely like the core. thanks!

@MaluNoPeleke
Copy link

I just tried the mentioned behaviour and found out that this is still not possible (talking about the async bool).
Can you add it to your plugin?

@bnomei
Copy link
Owner

bnomei commented Feb 11, 2022

@MaluNoPeleke as far as i can tell the

echo Bnomei\Fingerprint::css('/assets/css/style.css', ['async' => true, 'defer' => true, 'data-something' => 'my-value']);

should be working as expected.

@bnomei
Copy link
Owner

bnomei commented Feb 11, 2022

<link async data-something="my-value" defer href="http://fingerprint.local:8080/assets/css/style.css" rel="stylesheet">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants