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

Allow dev to specify extra attributes on the HTML element #13

Open
erikn69 opened this issue Apr 8, 2022 · 0 comments
Open

Allow dev to specify extra attributes on the HTML element #13

erikn69 opened this issue Apr 8, 2022 · 0 comments

Comments

@erikn69
Copy link
Contributor

erikn69 commented Apr 8, 2022

<link rel="stylesheet" href="https://kit-pro.fontawesome.com/releases/v5.9.0/css/pro.min.css"
     crossorigin="anonymous" integrity="sha256-0YPKAwZP7Mp3ALMRVB2i8GXeEndvCq3eSl/WsAl1Ryk=" />

If loading something from a CDN or other repositories, the dev might want to pass integrity,crossorigin or other attributes. Currently we have no way of doing that. So I think we should add a new method for that, so that you can do:

PHP

Bonsai::add('https://kit-pro.fontawesome.com/releases/v5.9.0/css/pro.min.css')
    ->setAttributes([
        'integrity' => 'sha256-0YPKAwZP7Mp3ALMRVB2i8GXeEndvCq3eSl/WsAl1Ryk=',
        'crossorigin' => 'anonymous',
    ]);

.bonsai.json

"https://kit-pro.fontawesome.com/releases/v5.9.0/css/pro.min.css" : {
    "attributes" : {
        "integrity" : "sha256-0YPKAwZP7Mp3ALMRVB2i8GXeEndvCq3eSl/WsAl1Ryk=",
        "crossorigin" : "anonymous"
    }
}

script tag id, async, crossorigin, defer, integrity, nomodule, referrerpolicy
link tag id, crossorigin, href, hreflang, media, referrerpolicy, sizes, title, type

@kaidesu it's a really small not breaking change, I would be glad to do it if you wish, but I await confirmation of the PRs that are pending

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

No branches or pull requests

1 participant